htmlmeta-tagsw3c-validationhtml4

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 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

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

Solution

  • 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.