Reputation: 2300
I read that self closing tags were problematic for some browsers such as IE7 and Firefox 3 here: Why don't self-closing script tags work?
I am curious if this issue can also hold true for linking stylesheets.
For example using
<link href="/css/style.css" rel="stylesheet" type="text/css" />
Instead of
<link href="/css/style.css" rel="stylesheet" type="text/css"></link>
Upvotes: 27
Views: 25633
Reputation: 8497
<link href="/css/style.css" rel="stylesheet" type="text/css"></link>
is not a good idea.
If you use html4 use this:
<link href="/css/style.css" rel="stylesheet" type="text/css">
If you use xhtml use this:
<link href="/css/style.css" rel="stylesheet" type="text/css" />
In html5 both versions are fine.
Upvotes: 38
Reputation: 478
http://www.w3.org/TR/html401/struct/links.html#edef-LINK
Start tag: required, End tag: forbidden
http://www.w3.org/TR/html5/document-metadata.html#the-link-element
Tag omission in text/html: No end tag.
http://www.w3.org/TR/html5/syntax.html#elements-0
"Void elements: ... link ..."
"Void elements only have a start tag; end tags must not be specified for void elements."
Upvotes: 27