[whatwg] [html5] Rendering of interactive content

Smylers Smylers at stripey.com
Wed Feb 11 07:54:17 PST 2009


Aryeh Gregor writes:

> On Wed, Feb 11, 2009 at 10:13 AM, Smylers <Smylers at stripey.com> wrote:
> 
> > Ah, I see.  Thanks for explaining that.  I'm interpreting it as "for
> > each bit of text that you cause the background colour to be set for,
> > also specify its foreground colour (and _vice versa_)".
> 
> But that's not *possible* in CSS.  Not within reason, anyway.  You
> can't be expected to set color for all descendants.

You're right.  It is possible if you presume foreground colours
generally inherit (except for links) and backgrounds are generally
transparent.  Which apparently I was presuming, but omitted to state.
Sorry for not thinking it through properly.

> > True, but that introduces other awkwardnesses.  Given that many
> > pages (or regions of pages) have a background colour shared across
> > several elements, it's tedious to have to specify it for each one --
> > and also harder to change.
> 
> It's the only way to be *sure* that things won't break (at least, you
> can be sure as long as everyone does it).

We can be sure that there are live websites out there currently not
doing it!

For a start, there are those which don't use CSS at all but on <body>
set the bgcolor, text, link, and vlink attributes (another reason why
links are special, since there aren't similar attributes for setting any
other elements' colours).

> I would say that what you're suggesting is an entirely different
> principle: stylesheet authors should manually set :link, :visited, and
> :hover foreground colors if they set any background color on any
> element that might contain a link, because they can't guarantee UA
> behavior otherwise.  This is a much more specific point -- it doesn't
> cover interaction with author or user stylesheets and requires at most
> three rules per set of stylesheets.

Yes.  And also the reverse (that if you set a link colour then set the
background colour on either links or an ancestor element).

> I'll agree that authors should always specify link colors to override
> the UA's stylesheet, if they specify backgrounds.

Hurrah -- in that case I think we're in agreement, and no changes to the
spec are necessary.

Smylers



More information about the whatwg mailing list