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

Re: The style attribute, again

From: Andy <aholmes84@shaw.ca>
Date: Mon, 12 May 2003 12:22:56 -0700
To: "Peter Foti (PeterF)" <PeterF@SystolicNetworks.com>, www-html@w3.org
Message-id: <3EBFF490.4070703@shaw.ca>

Peter Foti (PeterF) wrote:

>...
>
>My thought on the subject was that there should be a STYLE element allowed
>within the body of a document that could be applied to a certain scope.
>Perhaps a STYLE tag with an attribute that signifies an IDREF that
>identifies the container where the style should be applied.  For example:
>
><body>
>   <div class="b">
>      No styles here.
>   </div>
>   <style scope="imported">
>   .b { font-weight: bold; }
>   </style>
>   <div id="imported">
>      This text was <span class="b">imported</span>.
>   </div>
></body>
>
>Or perhaps some method of using namespaces to siginify where the style
>should be applied.  I never really put much thought into it, and no one
>seemed to take much notice when I suggested it.
>
>  
>
I must disagree. Using inline style just creates too many unnecessary 
problems, many of which are outlined in 
http://devedge.netscape.com/viewsource/2003/xhtml-style-script/

Your example causes conflictions as well using the 'id' attribute to 
apply your style, in addition to the fact that the style attribute is 
only allowed in the 'head' element. The obvious solution to the above 
problem is to simple use a different class name such as 'imported-b' or 
a selector such as:

    div#imported span.b {
       font-weight: bold;
    }

Selectors like this have been present in CSS since CSS1. CSS2 and CSS3 
(will) expand greatly upon selectors' "accuracy".


-Andy
Received on Monday, 12 May 2003 15:25:22 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 27 March 2012 18:15:55 GMT