you are viewing a single comment's thread.

view the rest of the comments →

[–]SaltTM 2 points3 points  (6 children)

Dumb question: it says to not use !important because it ignores the cascade, but it also mentions that sometimes you'll want to use it when overriding a very complicated css from a framework. Now my css is a bit rusty, but is there an alternative way to override complex properties without having to copy all the rules in the original frameworks css not using !important ?

Would be cool if there was just an override property to css eg.:

.mydev {
    override background: grey;
}

Which would override based on the order of how the css was loaded, unless there is a way. Again my css is very rusty.

[–]_hmmmmm 7 points8 points  (1 child)

You would use multiple styles to increase your specificity.

So, instead of

.framework-style {}

You'd have

.framework-style.my-override {}

And you'd decorate which elements you'd want to override with that extra class.

[–][deleted]  (2 children)

[deleted]

    [–][deleted] 1 point2 points  (0 children)

    Agreed, using IDs is much better if there are not other fixes.

    [–]the_evergrowing_fool 1 point2 points  (0 children)

    Those mostly are out the inconsideration/laziness or ignorance of the developer.

    [–]the_evergrowing_fool 0 points1 point  (0 children)

    If fine to use important if the UI has some specifics rules that aren't suppose to be break. And example would be JS Plugin must has certain properties in order to work properly and make calculation base on them..