Can self closing <link> tags be problematic?

Jeremy A. West picture Jeremy A. West · Mar 30, 2012 · Viewed 20.4k times · Source

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>

Answer

Hubert Sch&#246;lnast picture Hubert Schölnast · Mar 30, 2012

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