3

So, I wanted to use a ruleset in a style of a "ul" so that its "li" children would all have "display:inline".

<ul style="li {display:inline}">
  <li>item 1</li>
  <li>item 1</li>
  <li>item 1</li>
  <li>item 1</li>
</ul>

I thought it was possible and I came accross an old CSS reference:

http://www.w3.org/TR/2001/WD-css-style-attr-20010305

<p style="{color: green; width: 10em}                   /* a+=0 b+=0 c+=0 */
          ::first-letter {float: left; font-size: 300%}   /* a+=0 b+=0 c+=1 */
         ">

However, it seems to have gone away with latest revisions of CSS. Does someone know the status of this feature?

PS: please avoid comments on: you should use classes/stylesheets. The Law of Demeter is equally as important for maintenance.

James Donnelly
  • 126,410
  • 34
  • 208
  • 218
koriander
  • 3,110
  • 2
  • 15
  • 23

3 Answers3

4

When viewing official specifications it's always a good idea to check that you're looking at the latest version and that it is an actual recommended implementation and not just a draft.

The version you're looking at is marked as a Working Draft published in March 2001 - this means that it's 1. not a finalised version, and 2. rather old.

It even states:

This draft has been produced by the CSS working group as part of the style activity. It is a public W3C Working Draft for review by W3C members and other interested parties. As a draft document it may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use W3C Working Drafts as reference material or to cite them as other than "work in progress."

Right at the top there's a couple of links. One of these take us to the most up-to-date version:

enter image description here

That particular version (http://www.w3.org/TR/css-style-attr) was published in November 2013 and is a Recommendation. This means it's 1. a lot more recent, and 2. no longer just a draft, but actually recommended to be used.

This version states:

This document has been reviewed by W3C Members, by software developers, and by other W3C groups and interested parties, and is endorsed by the Director as a W3C Recommendation. It is a stable document and may be used as reference material or cited from another document. W3C's role in making the Recommendation is to draw attention to the specification and to promote its widespread deployment. This enhances the functionality and interoperability of the Web.

This latest version doesn't feature the syntax you're wanting to use.

James Donnelly
  • 126,410
  • 34
  • 208
  • 218
  • Maybe it's a good thing to also point out that inline styles are bad practice and that pseudo-classes/elements don't work in inline styles. – Vucko Sep 24 '15 at 10:03
  • 1
    @Vucko perhaps, but that's not really what the question is asking. – James Donnelly Sep 24 '15 at 10:04
  • More like the W3C needs to plaster that big red obsolescence notice all over their old, unmaintained specs. (Some HTML specs have done this, and it was recently applied to CSS2.1.) – BoltClock Apr 30 '16 at 03:10
3

As stated in the draft:

This draft has been produced by the CSS working group as part of the style activity. It is a public W3C Working Draft for review by W3C members and other interested parties. As a draft document it may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use W3C Working Drafts as reference material or to cite them as other than "work in progress."

Syntax of CSS rules in HTML's "style" attribute (http://www.w3.org/TR/2001/WD-css-style-attr-20010305)

It would appear that it was considered at one point but has since been removed as the working draft was replaced by CSS Style Attributes which states:

The value of the style attribute must match the syntax of the contents of a CSS declaration block (excluding the delimiting braces)

CSS Style Attributes (http://www.w3.org/TR/css-style-attr/)

Given W3C (and most developers!) recommend using external stylesheets in the majority of cases I personally don't think there is much chance of this being implemented in the future:

To specify style information for more than one element, authors should use the STYLE element. For optimal flexibility, authors should define styles in external style sheets.

Style Sheets (http://www.w3.org/TR/html401/present/styles.html)

Hidden Hobbes
  • 13,893
  • 3
  • 38
  • 64
2

http://www.w3.org/TR/2001/WD-css-style-attr-20010305 is an ancient (2001) working draft. It just never made it into any CSS specification.

BoltClock
  • 700,868
  • 160
  • 1,392
  • 1,356
James Fenwick
  • 2,190
  • 1
  • 20
  • 30