tags:

views:

25

answers:

4

Can some body explain why the TD element is taking width when its not allowed in strict mode.This is the code [Was not able to put code because of HTML rendering problem.]

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt;

<html>

<head>
 <meta http-equiv="Content-Type" content="text/xml+xhtml; charset=utf-8"/>
</head>
<body>
<table>
<tr>
    <td width="200">First</td>
    <td>Second</td>
</tr>
</table>

</body>
</html>
A: 

Even though it's deprecated per the spec the browser will still apply it because you specified it. It has to be lenient toward older docs which may otherwise have broken layouts if it didn't apply the attribute(s).

meder
A: 

Since you specified it the browser will apply it, but your document won't validate.

JMin
A: 

Your doctype (HTML 4.01) doesn't match your content type.

The content type should read application/xhtml+xml instead of text/xml+xhtml, and your web server should also serve your page as such in order for standards-compliant browsers to treat it strictly (that is, fail to render your document if it's invalid). Also, as Alohci says, you need to include an XML namespace for the XHTML spec.

<html xmlns="http://www.w3.org/1999/xhtml"&gt;

Otherwise, browsers will just render like you tell them to, ignoring standards, although if you try to validate this it'll still fail.

BoltClock
And, of course, if the OP does this, it'll still fail because there's no XHTML namespace specified anywhere.
Alohci
A: 

I did everything suggested but it still it is taking width attribute. I think it is because of browsers have to support it now but future browsers will throw an error on code like this

alter