On 25/07/11 01:10, Stanimir Stamenkov wrote:
I've started to think, user style sheets appear pretty much only useful
for modifying the default styling brought by UA style sheets, given the
current cascading order [1] rules. Cases where one wants to override
author styling involve using !important rules which in my experience get
effect in much more than the desired places. Compensating for this
involves greater digging into and understanding of the author styles
(which could be quite big and not easy to read), and finally causes
adding bunch of "unrelated" rules to the user style sheet.
Especially with the introduction of the @-moz-document rules, one
usually targets at overriding few specific author declarations, but
placing !important in the user style sheet often makes it override other
more specific author rules which one may don't really want to. For
example, the web page author has supplied:
.important {
color: red;
}
.important:hover {
color: green;
}
.important.other {
color: blue;
}
and the user style sheet contains:
.important {
color: inherit !important;
font-weight: bold;
}
This makes all '.important' rules have their 'color' overridden. While
this could be the intention, also, it is more often I want to modify
just the first rule I've identified by short inspection, and I don't
want to dig further to restore the effect of other rules I've overridden
undesirably.
Does it make sense to allow user styles/style sheets to specify they
want to be treated as author ones instead of user ones in the cascading
order? Example:
@cascade author;
/* The following rules will be added to the "author" stack. */
or:
@-moz-document cascade(author) url(...) {
/* The rules in this block will be added to the "author" stack. */
}
Or does this appear detail which is better handled by the way UAs
provide style customization capabilities to users, e.g. if the Stylish
extension [2] provided an option whether specific styles should be added
as user style sheet, or just added to the page/author style sheets.
[1] http://www.w3.org/TR/CSS2/cascade.html#cascading-order
[2] https://addons.mozilla.org/addon/stylish/
You mentioned the !important modifier, but don't forget the :not()
pseudo-class. For instance you could have used something like (untested)
.important:not(:hover):not(.other)
{ color: inherit !important
}
.important
{ font-weight: bold
}
Best regards,
Tony.
--
Real programmers disdain structured programming. Structured
programming is for compulsive neurotics who were prematurely toilet-
trained. They wear neckties and carefully line up pencils on otherwise
clear desks.
_______________________________________________
dev-tech-layout mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-layout