!important
TallPhotoGuy
Registered Users Posts: 160 Major grins
What does !important do
Thanks
Thanks
0
Comments
--- Denise
Musings & ramblings at https://denisegoldberg.blogspot.com
The "!important" says that that this CSS entry should jump to the head of the line and bypass the precedence rules. That's good because it makes sure that rule gets applied.
That's bad because it makes sure that rule gets applied *everywhere* unless overruled by another "!important" rule. There can be unintended consequences. Managing the CSS code with "!important" flags scattered about can get more convoluted than you would like. The general recommendation is to avoid using "!important" in add-on CSS unless you absolutely must because of the side-effects. Better to just find a more specific class selector. In my add-on CSS, I only use "!important" to override style commands that SmugMug puts directly into the HTML, something they don't do very often. (I'm surprised they do at all. It's generally considered better practice to do all the styling in CSS.)
Images in the Backcountry
My SmugMug Customizations | Adding CSS to Your Site | SEO for the Photographer | Locate Your Page/Widget Number | SmugMug Help Desk