开发者

Should I remove trailing slashes in meta tags?

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 Tran开发者_Python百科sitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

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


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜