W3C home > Mailing lists > Public > www-style@w3.org > October 1998

RE: Introducing property codependency.

From: Ian Hickson <py8ieh@bath.ac.uk>
Date: Tue, 27 Oct 1998 12:41:19 +0000 (GMT)
To: braden@endoframe.com
cc: www-style <www-style@w3.org>
Message-ID: <Pine.GSO.4.04.9810271229060.7403-100000@amos.bath.ac.uk>
>>>> The challenge is to simplify a stylesheet like the following:
>>>>
>>>>    P { color: black; background: white; }
>>>>    Q { color: black; background: yellow; }
>>>>    P A:link { color: blue; background: white; }
>>>>    P A:visited { color: navy; background: yellow; }
>>>>    Q A:link { color: blue; background: white; }
>>>>    Q A:visited { color: navy; background: yellow; }
>>>>
>>>> ...so that there are only four rules, but without compromising the
>>>> 'safeness' of the rules. In other words, one cannot simply make it:
>>>>
>>>>    P { color: black; background: white; }
>>>>    Q { color: black; background: yellow; }
>>>>    A:link { color: blue; }
>>>>    A:visited { color: navy; }
>>>>
>>>> ...since with this sheet we are faced with the possibility of
>>>> another stylesheet in the cascade applying a background to the A
>>>> element, and making the document unreadable.
>>>
>>> How about
>>>
>>> 	P { color: black; background: white; }
>>> 	P Q { background: yellow; }
>>> 	P A:link { color: blue; background: white; }
>>> 	P A:link { color: navy; background: yellow; }
> 
> Sorry, I made an error here. Last line should be
> 	P A:visited { color: navy; background: yellow; }

Sorry, I made an error too. A big copy+paste one :-)

This is what I *meant*, with the first set:

    P { color: black; background: white; }
    Q { color: black; background: yellow; }
    P A:link { color: blue; background: white; }
    P A:visited { color: navy; background: white; }
    Q A:link { color: blue; background: yellow; }
    Q A:visited { color: navy; background: yellow; }

So we have white bg paragraphs and yellow bg quotes, with black normal
text, blue link text and navy visited text.

How do you get _that_ to be in four lines?

>> I need something that will _always_ work.
> It will always work as defined in a compliant viewer. If you plan on
> using the Q element *not* inside P, then the styles I gave are
> inadequate. 
Right. I need some that work with *anything*, as do the 6 I give, but
using a lot less lines.

> If you *don't* plan on using Q not inside P, then there is no reason
> my styles won't be a perfectly adequate replacement.
I have no idea where my colleagues will put quotes.

>> Already now I have limited myself, so that External links can't
>> appear in Headers, for example.
> But is this a problem with CSS, or with your chosen mechanism for
> representing external links?
Bit of both, but given that the mechanism is to vary foreground colour
and keep background color the same for each area, then the problem is
in CSS (it's too unwieldy for listing every single possible
combination of foreground and background color).

>> To do the foreground/background comprehensively using just my three
>> different backgrounds and five different foregrounds is currently
>> unworkable.
> Why? Because you think it is too much work, or because the
> foreground/background colors are not really compatible?
Too much work.

With background colours of white, silver and yellow, then the
foregrounds can be almost any other colour.

> <shrug> People don't identify comments versus sidebars versus
> whatever based on color.
No, indeed not. However they are being represented with different
colours too (as do many magazines, for example). This makes it more
colourful, dare I say more readable.

> They identify them based on their spatial relationship to the main
> content. I'm not immediately sure how I would distinguish between a
> "comment" and a "sidebar".
Probably the header.

> Maybe just length. But I most likely wouldn't at all, regardless of
> the color.
No. But it looks better with three different colours (white bg, yellow
and green sidebars), and that is what I am interested in here. The
recognition and layout organisation came a long time before the
colouring.

>> So: What combinations of colours should I declare? Sixteen! I also
>> have my EM having a special color. Twenty! I may want to highlight
>> areas of text. Twenty five! Also, some documents have a specially
>> coloured colophon. Thirty! My documents also have subtly coloured
>> headers and footers. Thirty Five!
> Whoa. If you are using the same foreground color in all places, why
> can't you specify it just once?
*That's the whole POINT!*

Because if the background colours are different, however subtly, then
I MUST HAVE a SEPARATE rule for EVERY background/foreground
combination!!!

> For example, if, in my doc, I have P elements with classes Normal,
> Comment, SideBar, and Example, but *all* the P text in the doc
> should be black, this style would do the trick:
> P { color: black; }
No it wouldn't.

My user stylesheet has style:

   P { background: black; color: silver; }

> If I wanted all link text in all P elements (regardless of class) to
> be red, this should do it:
> P A:link { color: red; }
and my user stylesheet also has:

   A:link { background: red; color: yellow; }

>> That is thirty five *rules* -- and around fifty or more different
>> selectors. This is ridiculous. There must be some way in which we
>> can extend CSS so that this amount of redundancy is removed.
> I'm not convinced that we need any extension to avoid the redundancy
> you're talking about.
See above. It's not redundant.

-- 
Ian Hickson
Received on Tuesday, 27 October 1998 07:41:28 GMT

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