What the hell??!? (blah, blah of a wannabe alien)
Override CSS
So I found myself wanting to override a few items in a sitewide CSS file, but only for a single page… Rather than make entire new CSS elements, I figured there had to be a way to override the CSS file with a <style> clause within the page itself…
Sure enough, I finally figured it out… !important…
[code=css]
[/code]
!important can go at the end of any style attribute and it will override anything that isn’t “important”.
| Print article | This entry was posted by Shawn on July 21, 2009 at 6:38 am, and is filed under Uncategorized. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |
about 2 years ago
!important is my crucial go-to whenever I’m too lazy to figure out a more specific hierarchy.
about 2 years ago
Hey Shawn,
This is great, Thanks man,
I am pretty good at css but still learning.
Thanks for the tip.
Joseph
about 2 years ago
Not to forget the big bad and ugly IE #fail at it.. It ignores !important
about 2 years ago
Who cares… IE is stupid. I’m tempted to just block it at the router level.
about 2 years ago
@I’m tempted to just block it at the router level.
LOL – I wish IE would go away as well !
about 2 years ago
The syntax for that little gem threw me off the first time I saw it. I kept reading it as “not important”.