Heh. The CSS mastery



  • This really makes me go "wtf?" 

    [pvd@smc1-1 ~/www]$ egrep -e "\!important" --exclude=\*.svn-base -rf * | wc -l
    1198
    [pvd@smc1-1 ~/www]$



  • The author probably wishes there was a "really important" flag. Then, a !critical, and so on.

     Reminds me those self-important people setting all their outbound mail to to "!important" flag. Makes you regret such a feature ever existed.
     



  • I actually use it sometimes. But only on lowest level nested elements.
    Mostly for recurring elements that can be in multiple positions on a page.

    Like for instance a warning box or something, (bad exmaple but ok)

    instead of having to define it like

    #canvas #menu .warning_box,
    #canvas #popup .warning_box,
    #canvas #content .warning_box { background-color: red;}

    i rather write

    .warning_box {background-color: red !important; }

     

    It should be used sparingly though. And bascically only on elements where it would be a pain to keep defining it for multiple occurences, while it is in fact the same style your trying to define,
     



  • @stratos said:

    It should be used sparingly though.

    Agreed.

    Setting overrides is usually a sign hat you don't know how to do it elegantly. It's like adding more and more duct tape to something that should really be reassembled.



  • Well every other rule has !important on it. And it's a relatively small site.



  • !important , from W3C CSS specs ...

    CSS attempts to create a balance of power between author and user style sheets. By default, rules in an author's style sheet override those in a user's style sheet (see cascade rule 3).

    However, for balance, an "!important" declaration (the keywords "!" and "important" follow the declaration) takes precedence over a normal declaration. Both author and user style sheets may contain "!important" declarations, and user "!important" rules override author "!important" rules. This CSS feature improves accessibility of documents by giving users with special requirements (large fonts, color combinations, etc.) control over presentation.

    This means !important was never designed to override your own rules but rather for the author to override user rules or vice versa. Clearly someone doesn't understand the basics of CSS specificity and cascading. This also has negative impacts on useability since users are no longer able to override author rules for accessibilty reasons. !important should be used very sparingly and only for good reasons.
     



  • rules in an author's style sheet override those in a user's style sheet

    This is strangely backwards. What is the point of a user stylesheet if it does not override or even wholly replace author stylesheets automatically? That's equivalent to a dialog box "Are you sure?" followed by a dialog box "But are you REALLY sure?"



  • @dhromed said:

    rules in an author's style
    sheet override those in a user's style sheet

    This is strangely backwards. What is the point of a user stylesheet if it does not override or even wholly replace author stylesheets automatically? That's equivalent to a dialog box "Are you sure?" followed by a dialog box "But are you REALLY sure?"

    Why define a specific user/author style sheet at all, when you can simply hint at the fact that a client should/could be able to use a self-defined style sheet that will override the author's style sheet because of how CSS was designed.

     

     



  • @stratos said:

    Why define a specific user/author style sheet at all, when you can simply hint at the fact that a client should/could be able to use a self-defined style sheet that will override the author's style sheet because of how CSS was designed.

    Define a author stylesheet: so the page won't look like ass.
    Define a user stylesheet: so that a user can override certain styles for his own reasons, whatever they may be.

    What are you saying, exactly?
     



  • @dhromed said:

    @stratos said:

    Why define a specific user/author style sheet at all, when you can simply hint at the fact that a client should/could be able to use a self-defined style sheet that will override the author's style sheet because of how CSS was designed.

    Define a author stylesheet: so the page won't look like ass.
    Define a user stylesheet: so that a user can override certain styles for his own reasons, whatever they may be.

    What are you saying, exactly?
     



    arg, sorry i posted a bit quick from work, and misinterpeted your post. sorry.



  • @stratos said:

    @dhromed said:

    @stratos said:

    Why define a specific user/author style sheet at all, when you can simply hint at the fact that a client should/could be able to use a self-defined style sheet that will override the author's style sheet because of how CSS was designed.

    Define a author stylesheet: so the page won't look like ass.
    Define a user stylesheet: so that a user can override certain styles for his own reasons, whatever they may be.

    What are you saying, exactly?
     



    arg, sorry i posted a bit quick from work, and misinterpeted your post. sorry.

    waves hand 

    You are forgiven. :)

    So, I'm not sure what the OP's snippet does exactly, unless it adds !important to every property, in which case it's a wtfy workaround to wtfy program behaviour and standards definition, in which case two wrongs make half a right.


Log in to reply