Styles should not be referenced by a <link>

(If you don’t work with HTML, this next post will be of no interest to you.)

Rant: the way external CSS stylesheets are included in HTML now is not logical nor convenient.
So: <link type="test/css" href="(...).css" rel="stylesheet" /> is wrong,
it should be <style type="text/css" src="(...).css" />.

Why?

css Zen Garden
Because src is for now, href is for later

In a HTML page, there are a number of files (URLs) that have to be fetched to display:

  • any text in the document, within <h1>, <p> or <div> tags or not
  • any images, specified as <img src=”" /> (always external)
  • any iframes, specified as <iframe src=”" /> (always external)
  • any javascript, specified as <script src=”" /> (external or in-line)

There are also links to other URLs that are not for now: maybe one click away, maybe just there to be interpreted by the web browser:

  • anchor links, specified as <a href=”"></a>
  • links: prev/next, archive links, feed link, specified as <link rel=”" href=”" />

So: you need the src="" referenced files immediately, and the href="" ones not. The way stylesheets are referenced now breaks this logic.

Because <style> is for stylesheets

Why can you embed in-line CSS style information within <style> tags, but not external stylesheets? Compare that to Javascript:

Inline JS: <script>...</script> and
External JS: <script src="" />

That makes sense. The same should be possible for <style>. The way it works now is counter-intuitive and antiquated. So please add it to XHTML 1.1.

These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • digg
  • Furl
  • Ma.gnolia
  • NewsVine
  • Reddit
  • TailRank

If you're new here, you may want to subscribe to my RSS feed or receive updates via email. Thanks for visiting!

3 Responses to “Styles should not be referenced by a <link>”


  1. Gravatar Icon 1 Bart

    There are so many mistake in HTML :( Take the input-field. This won’t work: Here comes the value although it’s so logic.

  2. Gravatar Icon 2 Bart

    <input type="text>Here comes the input value</input>

  3. Gravatar Icon 3 Mark

    Maar het is toch nu reeds zo, ofwel doe je het via “link” met href, ofwel doe je het via @import met url.
    De tweede manier zal wel de standaard worden.

Leave a Reply