views:

50

answers:

2

Hi All,

W3c markup validation is asking me to remove trailing slashes on my page. Is this correct?...and will my page still be compliant in all browsers?

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

<meta http-equiv="content-style-type" content="text/css" **/**>

Many thanks!

+1  A: 

That is correct. For HTML 4.01 you shouldn't have trailing slashes (self-closing tags) for meta elements and I believe <link> elements if memory serves me correctly.

xhtml requires trailing slashes, though.

Atømix
As a related thread (but not directly) an interesting read: http://stackoverflow.com/questions/69913/why-dont-self-closing-script-tags-work
Atømix
+1  A: 

XHTML is HTML with an XML syntax. In XML all tags must be closed. Some HTML tags do not have closing tags so in XHTML they need to be self closed. This is achieved through placing an / in front of the >.

So any tags that you have with /> must be changed to remove the forward slash to be HTML conformant.

These aren't the only differences between the two specifications.

Philip Smith