Forum Moderators: open

Message Too Old, No Replies

problem with code wehn i want use xhtml

         

la3jeb

6:56 pm on Dec 4, 2009 (gmt 0)

10+ Year Member



<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" OnLoad="na_preload_img(false, 'images/_09.jpg', 'images/h_10.jpg', 'images/hollywood-car2_11.jpg', 'images/12.jpg', 'images/13.jpg');">

<table id="Tableau_01" width="879" height="737" border="0" cellpadding="0" cellspacing="0" align="center">


i want change this code to xhtml any help plz

Fotiman

8:00 pm on Dec 4, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Welcome to WebmasterWorld!

1. Why do you want to change it to xhtml? Are you still serving the page as text/html? If so, then you probably DON'T want to move to XHTML. For more, see Why most of us should NOT use XHTML [webmasterworld.com]

2. XHTML is very strict. You need to know what attributes are allowed, and which are not. For example, leftmargin and topmargin are not valid, and all attributes must be lowercase (onload vs. OnLoad).

3. The W3 Validator [validator.w3.org] can be extremely helpful for testing XHTML and HTML documents.

There are very few valid reasons to move to XHTML. You may be better off converting this to valid HTML 4.01 Strict instead, using this DOCTYPE:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

swa66

9:09 pm on Dec 4, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There are reasons to use xhtml [webmasterworld.com] despite the "tho shall not use xhtml" mantra, just make absolutely sure your code validates if you do use xhtml and most of the objections are moot.

Use CSS instead of the obsolete (in the eyes of xhtml anyway) html attributes.

E.g. using inline style:

<body style="margin:0;" onload="na_preload_img(false, 'images/_09.jpg', 'images/h_10.jpg', 'images/hollywood-car2_11.jpg', 'images/12.jpg', 'images/13.jpg');">

<table id="Tableau_01" style="width:879px; height:737px; border:none; border-collapse: collapse; margin: 0 auto;">

Since I'm very rusty in html attributes I might have missed what some of them do.

Inline CSS is about the worst possible way to do it: use CSS files instead and get far more benefit.