W3C home > Mailing lists > Public > www-style@w3.org > August 2002

Re: CSS 2.1 WD and non-CSS presentational hints

From: Coises <Randy@Coises.com>
Date: Mon, 19 Aug 2002 19:32:57 -0700
To: www-style@w3.org
Message-ID: <4ju2musbg23jbgempikbd4od5vramdg9ro@4ax.com>

[Mon, 19 Aug 2002 16:52:51 -0400] L. David Baron:
>However, I've yet to see a good argument that CSS2.0 is interoperably
>implementable, as written.  We need a much clearer definition of
>"non-CSS presentational hint".  Do we define it as any stylistic
>suggestion in the markup that is caused by the presence of an attribute
>rather than the presence of an element?  That might work well for HTML,
>but does it make sense for things like SVG?  Do we instead define it as
>any stylistic suggestion associated with markup that has a
>clearly-defined presentational purpose?  That might work well for HTML
>as written, but the meaning doesn't make much sense given the
>implementation of HTML on the web today.

Consider the definition I suggested elsewhere in this thread:

     A "non-CSS presentational hint" is information which is derived
     from the document and is translated into CSS properties by
     the user agent through some mechanism other than CSS style rules.

Note that "CSS style rules" includes the user agent default style sheet.


This definition has two important "formal" characteristics:

1. It presumes nothing about the document language.
2. It requires no separate definitions of other potentially ambiguous terms
   (such as "presentational").

The first property is necessary because CSS is expected to be independent
of specifics of the document language; the second assures that we're not
displacing a possibly significant part the problem under consideration onto
another, as yet unspecified, definition.


* Is this definition reasonable, and reasonably intuitive?

CSS is a means of specifying various details regarding presentation, so it
makes sense that "presentational hints" would be things that affect CSS
properties.  If something influences "presentation" in a way that doesn't
affect CSS properties, it can't concern the CSS specification: CSS "knows"
the document only as a tree of elements, the formal characteristics that
determine which CSS simple selectors match each element, and the set of CSS
property values which pertain to each element.  This seems sensible.
"Presentation" is basically equated to "what is within the scope of CSS."

What could "non-CSS" mean?  One's first reaction might be that <B> and <P>
involve "non-CSS presentational hints"... but the CSS property values
assigned to such tags are derived from style sheets (often the user agent
default style sheet).  The properties derived from these elements can't be
assigned a place in the cascade, because they result *from* the cascade.
So "non-CSS" must mean "not the result of any CSS specifications."

In slightly different words: "If something in the document implies certain
values for one or more CSS properties, but the connection between the
document specification and the resultant CSS properties is not expressed in
CSS, that's a non-CSS presentational hint."  This seems reasonable to me.


* Does this definition do what we want?  Is it useful?

The definition encompasses exactly those specifications that interact with
CSS (because they affect CSS properties) but do not have an already-defined
place in the cascade (because CSS rules don't control them).  In this
sense, it captures exactly what we need.

Unfortunately, this definition does beg a new question: what SHOULD go in
the (real or virtual) user agent default style sheet, and what SHOULD be
treated as a "non-CSS presentational hint"?

I believe it will not be possible to define this in a CSS specification ---
it depends too much on the document language, and perhaps on specific
implementations.  From the standpoint of CSS, this must be left to the
discretion of each user agent.  I think this is as good as it gets, unless
we want to define this as a matter of document language specifications.


* How does this affect the potential for "interoperable implementations"?

First, it is important to note that under any existing or proposed CSS
specification the relationships between author style sheets, document
language features and the user agent's defaults are unaffected by whether
the default presentation of a given feature of the document language is
implemented through the user agent default style sheet or as a non-CSS
presentational hint.  It is *only* relationships involving non-!important
user style sheet declarations that may be at issue.

At minimum, "non-CSS presentational hint" MUST include whatever affects CSS
properties but cannot be expressed in a style sheet.  For example, there is
no way to write a CSS 2 declaration that implements the BACKGROUND
attribute of the BODY tag in HTML; so that must be a non-CSS presentational
hint.  In HTML, the reasonable assumption is that presentational
information that is associated with an element name should be handled in
the user agent default style sheet, while information from attribute values
should generally be treated as non-CSS presentational hints; but this
definition doesn't enforce that (nor could it be enforced without involving
CSS in document language details that should remain outside its scope).

For example, a browser maker could choose to include:
     P[ALIGN=LEFT]    {text-align: left}
     P[ALIGN=CENTER]  {text-align: center}
     P[ALIGN=RIGHT]   {text-align: right}
     P[ALIGN=JUSTIFY] {text-align: justify}
in the user agent default style sheet --- in which case, the ALIGN
attribute of the P tag would *not* be a non-CSS presentational hint.
Similarly, a browser maker could omit:
     B {font-weight: bold}
     I  {font-style: italic}
     U {text-decoration: underline}
from the user agent default style sheet, in which case the expected default
styling of those tags would be seen as non-CSS presentational hints.

Certainly a positive point of the change suggested for CSS 2.1 is that this
would be a moot point --- the user agent's choice of how to implement a
particular language feature would have no effect on the interpretation of
user style sheets.  However, I believe this would be greatly outweighed by
the negative effects the change would have in practice on the interaction
between user style sheets and HTML stylistic attributes.

By implementing the default styles of tags without attributes --- such as:
     P {display: block; margin: 1.33em 0}
for paragraphs --- in the user agent default style sheet, but treating
stylistic attributes (such as the ALIGN attribute of the P tag) as non-CSS
presentational hints, the user agent creates a distinction that can be used
to make user style sheets more functional.  For example, suppose I wanted
to change the *default* alignment of paragraphs to "JUSTIFY" --- but not
override explicitly specified alignments.  In CSS 2 --- if the browser
implements ALIGN as a non-CSS presentational hint --- I could write:
     P {text-align: justify}
and the job would be done; in CSS 2.1 --- or in a browser that implements
ALIGN in the user agent default style sheet --- this rather messy code:
     P                {text-align: justify}
     P[ALIGN=LEFT]    {text-align: left}
     P[ALIGN=CENTER]  {text-align: center}
     P[ALIGN=RIGHT]   {text-align: right}
would be required.

Now, here's the thing... the "second method" above is clumsy to the exact
degree that it is clumsy to express a given document language feature in a
style sheet; and it becomes impossible (for example, for the BACKGROUND
attribute of the BODY tag) when it is impossible to express the feature in
a style sheet.  The proposed definition of a "non-CSS presentational hint"
thus tends to suggest an appropriate division.

Even though the division is not a matter of standards, and thus may differ
from browser to browser, at least it will be constant for any one browser.
Since only user style sheets are affected --- and these are likely to be
written for a specific browser anyway --- this should not be a serious
problem.  It's unfortunate... but the alternative is worse.

With the proposed CSS 2.1 change the distinction between default
characteristics of a language element and those specified by HTML stylistic
attributes would have no effect --- even for attributes that cannot be
defined using CSS declarations.  The "second method" would be the only
method... and, of course, it's unavailable for attributes that cannot be
expressed as a CSS declaration.  This is why the change would render it
impossible to set defaults without overriding presentational attributes.

We can probably assume that similar considerations would apply to other
document languages with which CSS might be used.  (Examples, anyone?)
-- 
Randall Joseph Fellmy aka Randy@Coises.com
Received on Monday, 19 August 2002 22:33:29 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:15 GMT