Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > XHTML style attribute

Reply
Thread Tools

XHTML style attribute

 
 
Anonymous
Guest
Posts: n/a
 
      03-02-2008
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
 
Reply With Quote
 
 
 
 
Jonathan N. Little
Guest
Posts: n/a
 
      03-02-2008
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
 
Reply With Quote
 
 
 
 
Jukka K. Korpela
Guest
Posts: n/a
 
      03-02-2008
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/

 
Reply With Quote
 
Michael Fesser
Guest
Posts: n/a
 
      03-02-2008
..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
 
Reply With Quote
 
XHTML
Guest
Posts: n/a
 
      03-02-2008
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.
 
Reply With Quote
 
XHTML
Guest
Posts: n/a
 
      03-02-2008
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.
 
Reply With Quote
 
Jonathan N. Little
Guest
Posts: n/a
 
      03-02-2008
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
 
Reply With Quote
 
Michael Fesser
Guest
Posts: n/a
 
      03-02-2008
..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
 
Reply With Quote
 
Jonathan N. Little
Guest
Posts: n/a
 
      03-02-2008
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
 
Reply With Quote
 
Jonathan N. Little
Guest
Posts: n/a
 
      03-02-2008
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Validation (XHTML 1.0 Transitional): Attribute 'height' is not a valid attribute of element 'table' perspolis ASP .Net 1 01-23-2007 07:57 AM
Validation (XHTML 1.0 Transitional) - Attribute..... is not a valid attribute of..... Radu ASP .Net 2 01-03-2007 03:41 PM
Validation (XHTML 1.0 Transitional): Attribute 'leftmargin' is not a valid attribute of element 'body'. anonymous ASP .Net 1 08-02-2006 08:05 AM
parse URL (href) from xhtml, xhtml -> text, for data hawat.thufir@gmail.com XML 7 02-08-2006 07:39 PM
Need help with Style conversion from Style object to Style key/value collection. Ken Varn ASP .Net Building Controls 0 04-26-2004 07:06 PM



Advertisments