[whatwg] [html5] Rendering of interactive content

Smylers Smylers at stripey.com
Wed Feb 11 05:36:45 PST 2009

Aryeh Gregor writes:

> On Tue, Feb 10, 2009 at 10:30 PM, Ian Hickson <ian at hixie.ch> wrote:
> > > If the UA suddenly displays hyperlinks in green and I decided that
> > > my background is green, the user will complain with me, not with
> > > the UA (and will probably switch to a different website)
> > 
> > Authors should never the background colour without setting the
> > foreground colour. So that would be the author's fault.
> I don't think that's relevant.

It is relevant, because as you then say:

> If I, as an author, use the rule
> body { color: white; background: green; }
> and the UA uses the rule
> :link { color: green; }
> then links would be invisible despite my background color.

That is precisely an instance of an author setting a background colour
without a foreground colour -- specifically the author set the
background colour used on links without setting the foreground colour
for links.

If an author sets a background colour then she needs to set the
foreground colour for all text that appears on it, anywhere.

> Although authors are encouraged to always set colors and backgrounds
> together, UAs conventionally do *not* do this for links, for fairly
> good reason.

Browsers do of course (typically) set both together -- in that they
provide a default background colour, plus foreground colours for visited
links, unvisitied links, and non-link text.  If an author overrides one
of those four then he generally needs to override all of them (except in
circumstances where he knows the area in question won't have any links,
or any-non links, or any text).

> You could say that not only should authors never set the background
> color without setting the foreground color, they should also never set
> the background color without setting the *link* color.


> But this still doesn't help if the UA (or a user stylesheet) uses
> span { color: green; }
> for some strange reason

Indeed.  That would be strange.  So strange that I really don't see why
HTML 5 should be concerned with it, and I certainly don't think there's
anything it can do about it:

* A user-agent that does something as arbitrary as the above is unlikely
  to achieve much market share.

* A user style-sheet that does the above has been presumably set by a
  user who wants it.  Let her.

> (not much stranger than green links by default!),

It's significantly stranger, for a couple of reasons:

* Links are a distinct type of element with a specific purpose.
  <span>-s convey no semantics of their own, and are used for multiple

* Links are conventionally a different colour from other text; <span>-s
  aren't.  Prefering links to be green rather than blue is a minor
  change, possibly one of aesthetics or to assist somebody who has
  trouble distinguishing certain colours.  Whereas prefering <span>-s to
  be green rather than indistinguishable from the surrounding text is
  adding in a distinction not normally seen.

> in which case everything is still messed up.

Yes.  Users can choose to implement custom styles which mess things up.
Users are free to do that if they want.

They may even have good reasons for doing so; for example, when
attempting to debug a website it can be useful to make various elements
different colours to show which is rendered where.  It's possible that
at some point I want to debug your website, or examine how you achieved
a particular effect, and that making your <span>-s green will assist me
in doing that.

> I don't think there's any way around this.

We don't want a way "round" it.  It's a feature that users are in
ultimate control.


More information about the whatwg mailing list