![]() |
XHTML style attribute
What does this mean "Style Attribute Module Deprecated" on
http://www.w3.org/TR/xhtml11/doctype.html#s_doctype? Does it mean I shouldn't use <p style="color:red">Some text</p> in my XHTML 1.1 documents? I use CSS classes, but what if I need to apply a specific style to a only single element of my document? Should I define class just for it, or is it acceptable to use style attribute instead? Ty |
Re: XHTML style attribute
Anonymous wrote:
> What does this mean "Style Attribute Module Deprecated" on > http://www.w3.org/TR/xhtml11/doctype.html#s_doctype? > > Does it mean I shouldn't use <p style="color:red">Some text</p> in my > XHTML 1.1 documents? > > I use CSS classes, but what if I need to apply a specific style to a > only single element of my document? Should I define class just for it, > or is it acceptable to use style attribute instead? Give element some ID and add #someID {} rule -- Take care, Jonathan ------------------- LITTLE WORKS STUDIO http://www.LittleWorksStudio.com |
Re: XHTML style attribute
Scripsit Anonymous:
> What does this mean "Style Attribute Module Deprecated" on > http://www.w3.org/TR/xhtml11/doctype.html#s_doctype? Did you notice the following sentences sentences in the document? "This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress." > Does it mean I shouldn't use <p style="color:red">Some text</p> in my > XHTML 1.1 documents? In the absence of any specific technical definition for "deprecated" in the document, that's pretty much what it means. But why are you using XHTML 1.1, or XHTML in general, in the first place? Just use HTML 4.01. Check the past discussions if you need an explanation. XHTML 1.1 was an exercise in futility, and the newest draft, over a year old now, makes it even more pointless. The W3C processes show their absurd side here. A _draft_ that old, and with such an instability disclaimer, is advertized as the newest version, despite the fact that the year 2001 version is still a "W3C Recommendation". > I use CSS classes, but what if I need to apply a specific style to a > only single element of my document? Should I define class just for it, > or is it acceptable to use style attribute instead? There's no real reason why you couldn't use a style attribute. Neither is there any good reason to use it, since there are slightly better structured alternatives, such as using a class attribute _or_ an id attribute and an appropriate selector. The choice between class and id when you _expect_ that the rule will only be applied to one element is more or less a matter of taste, but to be really logical, use class unless you _know_ that the rule will only be applied to one element only (in one document) ever, in which case id is the logical choice. -- Jukka K. Korpela ("Yucca") http://www.cs.tut.fi/~jkorpela/ |
Re: XHTML style attribute
..oO(Jonathan N. Little)
>Anonymous wrote: >> What does this mean "Style Attribute Module Deprecated" on >> http://www.w3.org/TR/xhtml11/doctype.html#s_doctype? >> >> Does it mean I shouldn't use <p style="color:red">Some text</p> in my >> XHTML 1.1 documents? >> >> I use CSS classes, but what if I need to apply a specific style to a >> only single element of my document? Should I define class just for it, >> or is it acceptable to use style attribute instead? > >Give element some ID and add #someID {} rule This would lead to a hundred additional IDs in my stylesheets, simply because every page may have its own purely decorational side image. The markup for this is generated by a script and uses an inline style to define the 'background-image' property. IMHO 'style' attributes have their use and are the appropriate solution in some cases. Micha |
Re: XHTML style attribute
Michael Fesser wrote:
> ... I agree on this with you. It is unpractical for me to assign stylesheet identificator just for a single element. It makes my stylesheet less readable. |
Re: XHTML style attribute
Jukka K. Korpela wrote:
> But why are you using XHTML 1.1, or XHTML in general, in the first > place? Just use HTML 4.01. Check the past discussions if you need an > explanation. Well, basically this is the story. I was using HTML 4.01 Strict. The main difference between HTML 4.01 and XHTML 1.1 are tags like <br/>, <link/> and the fact I ocasionally need to use <![CDATA[...]]> blocks. I got used to zhat. On the JavaScript side the main difference is that element names are returned in lowercase. > XHTML 1.1 was an exercise in futility, and the newest draft, over a year > old now, makes it even more pointless. The W3C processes show their > absurd side here. A _draft_ that old, and with such an instability > disclaimer, is advertized as the newest version, despite the fact that > the year 2001 version is still a "W3C Recommendation". I agree with you on that. I don't take them seriously (W3C) as I used to. |
Re: XHTML style attribute
Michael Fesser wrote:
> .oO(Jonathan N. Little) > >> Anonymous wrote: >>> What does this mean "Style Attribute Module Deprecated" on >>> http://www.w3.org/TR/xhtml11/doctype.html#s_doctype? >>> >>> Does it mean I shouldn't use <p style="color:red">Some text</p> in my >>> XHTML 1.1 documents? >>> >>> I use CSS classes, but what if I need to apply a specific style to a >>> only single element of my document? Should I define class just for it, >>> or is it acceptable to use style attribute instead? >> Give element some ID and add #someID {} rule > > This would lead to a hundred additional IDs in my stylesheets, simply > because every page may have its own purely decorational side image. > The markup for this is generated by a script and uses an inline style > to define the 'background-image' property. No, you can put page specific styles in a style element in the head. The style element is not deprecated in xhtml1.1 just then inline style attribute. > > IMHO 'style' attributes have their use and are the appropriate solution > in some cases. Yes, but xhtml folks want persuade you not to, and to encourage you ro separate style from the markup. -- Take care, Jonathan ------------------- LITTLE WORKS STUDIO http://www.LittleWorksStudio.com |
Re: XHTML style attribute
..oO(Jonathan N. Little)
>Michael Fesser wrote: > >> This would lead to a hundred additional IDs in my stylesheets, simply >> because every page may have its own purely decorational side image. >> The markup for this is generated by a script and uses an inline style >> to define the 'background-image' property. > >No, you can put page specific styles in a style element in the head. Correct. Might be an option if I find the time to rewrite that script. Micha |
Re: XHTML style attribute
Michael Fesser wrote:
> .oO(Jonathan N. Little) > >> Michael Fesser wrote: >> >>> This would lead to a hundred additional IDs in my stylesheets, simply >>> because every page may have its own purely decorational side image. >>> The markup for this is generated by a script and uses an inline style >>> to define the 'background-image' property. >> No, you can put page specific styles in a style element in the head. > > Correct. Might be an option if I find the time to rewrite that script. > Rewrite that script? <style type="text/css"> #foo { margin-left: 0; } #bar { color: #f00; background-color: #fff; } </style> </head> <body> .... -- Take care, Jonathan ------------------- LITTLE WORKS STUDIO http://www.LittleWorksStudio.com |
Re: XHTML style attribute
XHTML wrote:
> Well, basically this is the story. I was using HTML 4.01 Strict. The > main difference between HTML 4.01 and XHTML 1.1 are tags like <br/>, > <link/> and the fact I ocasionally need to use <![CDATA[...]]> blocks. I > got used to zhat. On the JavaScript side the main difference is that > element names are returned in lowercase. And the added benefit of when you use XHTML 1.1 you can alienate all those IE users! -- Take care, Jonathan ------------------- LITTLE WORKS STUDIO http://www.LittleWorksStudio.com |
| All times are GMT. The time now is 01:25 AM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.