Re: Display

On Tue, Apr 27, 2010 at 2:40 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> It's not clear to me how "default" would be defined.  Care to suggest a
> definition?

The general idea would be like this, I think.  When computing an
element's style, UAs would compute two values: one as now, and one
ignoring all author stylesheets.  If the first value evaluated to
"default", then the second value would be used.  Otherwise the second
value would be ignored.  (Of course, any equivalent implementation
would be fine -- the UA need not actually remember both values in all
cases.)  Probably best to treat user stylesheets the same as author
stylesheets here, and have the CSS override presentational hints as
usual, but these are edge cases and it doesn't really matter.

The reason for this is so that you can undo all CSS statements with
later statements.  Because of CSS's cascading nature, it's common to
have several stylesheets from different places layered on top of each
other.  For instance, you often have a site-wide stylesheet and then a
page-specific one.  MediaWiki has some stylesheets added by the core
software, some more by the skin, some more by software extensions,
some more added by site admins for all skins, some more added by site
admins for a particular skin, and some more that each user can set up
for himself.

Often one party here wants to override an earlier one, but can't
actually change the earlier stylesheet, just add rules to his own.
This usually works great.  But for instance, if a stylesheet sets
textarea { font-family: Courier, monospace } (which always annoys me
on Linux because Courier looks terrible for some reason), that can't
be undone by a later stylesheet.  textarea { font-family: monospace }
is wrong, because some browsers use proportional fonts for textareas.
textarea { font-family: default } would have the desired effect.

It's come up for me at least once, but it's not a big deal to me, more
like "would be nice to have".  I don't know if it would be worth the
implementation effort to add such a feature.  Maybe other people can
explain their real-life use-cases.

Received on Wednesday, 28 April 2010 18:09:21 UTC