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

Some Views on CSS

From: Russell Steven Shawn O'Connor <roconnor@wronski.math.uwaterloo.ca>
Date: Fri, 10 Apr 1998 16:36:54 -0400 (EDT)
To: www-style@w3.org
Message-ID: <Pine.SOL.3.95q.980410163435.9771A-100000@wronski.math.uwaterloo.ca>
I posted the following to comp.infosystems.www.authoring.stylesheets.  Of
paticular interest to this mailing list is the last paragraph where I
point out what I believe to be a problem with CSS.

-----BEGIN PGP SIGNED MESSAGE-----

I currently have a small global style sheet for all my web pages.  It
doesn't do much.  It sets the background colour, text colour, and link
colours.  It also centres H1 elements.  Recently I started thinking that it
really isn't my place to decide what colours the user should see, so I was
considering deleting my style sheet.  But this causes a problem when I need
to highlight a particular section of text for a reason that isn't covered
by current HTML elements.  If I specify one colour for one kind of
selector, then I must specify colours for all selectors in order to avoid
colour collisions with UA defaults.

The problem goes beyond colours and extends to all style properties.  Even
if I wanted to highlight a word by italicizing it, I can't be sure that the
UA doesn't render text as italics by default.

It seems like style sheets can't cascade, but this issue was addressed by a
previous thread in this NG (``Cascading a silly idea?'').  It was suggested
that user style sheets should only be used to modify the previous
style-sheet in the cascading order, by using rules such as relative font
size.  Another suggestion was to use modular style sheets.

The first suggestion leads me to believe that there should be two
fundamental types of style sheets.  They are absolute style sheets and
relative style sheets.  If a style sheet specifies an absolute value for
any property, say a colour or a absolute font size, then it *must* specify
absolute values for everything in order to avoid collisions with other
style sheets.  This would be an absolute style sheet.  If a style sheet
only specifies relative styles, such as relative font size, then it is a
relative style sheet.  Relative style sheets must specify the same style to
all possible selectors.  For instance if I were to only decrease the font
size of H1 elements, it may end up looking identical to an H2 style after
the cascade.  So if I decrease the font size of one selector, I must
decrease the font size of all selectors by the same amount.

The second suggestion leads me to believe that the above isn't quite as bad
as it sounds.  The colour property cannot collide with a text-decoration
property.  So style sheets can be divided into mutually exclusive modules.
(I suspect the doesn't-collide relation of CSS properties form an
equivalence relation.)  Each module is either an absolute module or a
relative module.  If one absolute property is specified in a module, then
it is an absolute module and must specify absolute values for everything
that can be specified in the module.  If the module has only relative
values, then it is a relative module.  Relative modules must specify the
same style to all possible selectors.

I should point out that there is still more flexibility when a person
controls the cascading order.  If I import another style sheet, or
otherwise know that one of my style sheets is cascaded immediately over top
of another of my style sheets, then it is the combination of all the style
sheet that I control that need to satisfy the above requirements.  For
instance it is okay if I use ``<STYLE>P {color:  red}</STYLE>'' directly in
my HTML source if I'm importing a style sheet with LINK and I specify all
colours for all selectors in that imported style sheet, and I know that
this new rule won't conflict with my other rules in my imported style
sheet.

So this thinking has answered my question.  If I need to highlight an
element with say a colour, then I must specify the colours for every
selector in that document.  For site consistency, I therefore must specify
colours for every selector in my global style sheet.  And even if I don't
highlight any elements with any particular colours in any documents in my
site, I still must specify all colours for all selectors, because I may
wish to do such highlighting in the future, and I'd like to have my site
look consistent through time.  So I'm going to extend my style sheet to
colour all HTML elements.

If you were paying attention you may have noticed something a little
disturbing as a result of what I have said.  There is a fundamental problem
with CSS.  You can't specify rules for all selectors as is required for
absolute and relative modules.  I can specify a colour scheme for all the
HTML elements, but I can't be sure that the default style sheet for a UA
has some rule like ``TABLE DIV P EM I {color:  red}'' that I haven't
overridden that may conflict with my style sheet.  Somehow the ability to
delete previous rules for all selectors that define a property must be
added to CSS, likely by adding use of some kind of new @ rule.  I don't
know of a good solution.  I just see the problem.

-----BEGIN PGP SIGNATURE-----
Version: 2.6.3ia
Charset: cp850

iQCVAwUBNS6PiKRQY0HgM7mlAQG/eQQAly0wPXodwHuEhK9iWj2WYmjb//FRZz6Y
oCBcm5EuVGVZacmv6F8b4ONkrdqa1Xk2FDefV6MrcDd9NO2qshSF52W8NBcamVM0
QITWW6X+10jbVq/2tJo6t5h1hrkrnW5/N81F0tsybkMzkvYoGWiu484rEuQhKGWl
7Drs++OPsTs=
=fRu5
-----END PGP SIGNATURE-----

-- 
Russell O'Connor                           roconnor@uwaterloo.ca
    <URL:http://www.undergrad.math.uwaterloo.ca/%7Eroconnor/>
"And truth irreversibly destroys the meaning of its own message"
-- Anindita Dutta, "The Paradox of Truth, the Truth of Entropy"
Received on Friday, 10 April 1998 16:36:57 GMT

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