W3C home > Mailing lists > Public > www-html@w3.org > April 2003

Re: Scope of the <link> tag (specifically the scope of CSS style sheets)

From: David Woolley <david@djwhome.demon.co.uk>
Date: Fri, 4 Apr 2003 21:03:49 +0100 (BST)
Message-Id: <200304042003.h34K3nh03617@djwhome.demon.co.uk>
To: www-html@w3.org

> extension to the <style> tag, it always seemed slightly unusual that
> while you can link an external script file in using <script> that it is
> not the <style> tag that is used to reference an external CSS style
> sheet (but that is a whole other discussion!).

I think that is because script was forced on the language by the browser
developers, whereas style came from W3C!  I.E. it is the script usage that
is anomalous.

> <link rel="stylesheet" type="text/CSS" href="menu.css">
>   <my menu html>
> </link>

This effect can already be achieved by:

<style type="text/css">
div.menu element etc {....}

<div class="menu">

And this has the distinct advantage that the user, who is always supposed
to have last say on styling (user !important overrides author !important,
for this reason) is not put at a disadvantage as the result of the author
having a mechanism that is not available to the user.

It's also better in that, if, like the above, you use classes, you can
consistently use the same styling throughout the document.  (You don't 
need the div in the selector, and you could have #mymenu, and id="mymenu".)

Finally, note that using link for external style sheets is obsolescent,
as XML languages, more correctly, use a processing instruction to 
specify the style sheet.
Received on Friday, 4 April 2003 16:32:38 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:06:03 UTC