Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-12-11 10:11:52

Timid&friendly
Member
From: The Netherlands
Registered: 2006-05-28
Posts: 252
Website

Your opinion on !important declaration please

Hi groovey TXP peoples,

I am making the templates for a big multinational corporation website and have submitted a quick draft to the back-end developers.

One of the comments surprised me. They referred to the !important declaration as a hack. What is your take on the !important declaration.
Let me have it lol.


I think, therefore I AM, … … er … I think :-?

Offline

#2 2008-12-11 14:14:24

Walker
Plugin Author
From: Boston, MA
Registered: 2004-02-24
Posts: 592
Website

Re: Your opinion on !important declaration please

not a hack, but…..use should be limited.

I generally only use it where I don’t have full contol of all included css.

Like a social network that allows you to apply secondary sheeets but has a default in place.

Offline

#3 2008-12-11 20:23:04

graeme
Plugin Author
Registered: 2004-06-21
Posts: 337
Website

Re: Your opinion on !important declaration please

No, it’s not a hack.

Though I will try to avoid them where possible as I find it can make it harder to follow what doing what. But saying that I have been know to use them when rushed and as Walker pointed out they certainly are very useful styling a site you don’t run.

Offline

#4 2008-12-12 07:14:43

Timid&friendly
Member
From: The Netherlands
Registered: 2006-05-28
Posts: 252
Website

Re: Your opinion on !important declaration please

Clear as crystal.

That’s how i see things but it’s good to have a second, third, fourth opinion sometimes…

Cheers


I think, therefore I AM, … … er … I think :-?

Offline

#5 2008-12-12 15:43:51

hakjoon
Member
From: Arlington, VA
Registered: 2004-07-29
Posts: 1,634
Website

Re: Your opinion on !important declaration please

IE6 does not respect the !important attribute so for a long time it was used as a way to get around rendering differences. Maybe that’s why they think it’s a hack.

It’s a value tool in dealing with the cascade.


Shoving is the answer – pusher robot

Offline

#6 2008-12-12 16:10:10

Timid&friendly
Member
From: The Netherlands
Registered: 2006-05-28
Posts: 252
Website

Re: Your opinion on !important declaration please

Cheers Hakjoon,

Thx for the feedback, every little helps.

But actually that’s a misconception about IE6. It actually does PARTIALLY respect the !important attribute.
The only time it doesn’t is when the same css property is declared twice in a selector. e.g.

h2 { width:100px !important; width:50px; }

Only in this instance will IE6 ignore the !important attribute, otherwise it works fine in IE

Last edited by Timid&friendly (2008-12-12 16:12:30)


I think, therefore I AM, … … er … I think :-?

Offline

#7 2008-12-15 05:51:50

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: Your opinion on !important declaration please

It could be hackish, depends on how you’re using it. :)

Offline

Board footer

Powered by FluxBB