WebArtz - The Web Design Forum
Welcome to WebArtz, Guest!

WebArtz is a nice place for discussions related to web designing and coding. We help our members to code their own website templates with HTML and CSS. We give them advice on various issues.

To know more about WebArtz Forum, visit the About Us page.

At the moment, you are viewing the forum as a guest. As a guest you can't make post and participate in discussions. You need to register and become a member of the forum. Click the register link below and become a part of this forum.

Thank You


You are not connected. Please login or register

View previous topic View next topic Go down  Message [Page 1 of 1]

1 !important on Sun Mar 27, 2011 10:27 pm

Agent24


Registered Member
Registered Member
I was just looking at some css coding and I seem to see !important in a lot of them. I was just wondering, when do I put this? I was trying out certain things and it seems to work without it.

2 Re: !important on Mon Mar 28, 2011 12:27 am

blindbat1457


Registered Member
Registered Member
!important overrides commands.

For example lets say my CSS shows

body {
color:000000;
}

and lower down in my HTML I want the text to be white then I would make an inline style put the color and !important after it.

3 Re: !important on Mon Mar 28, 2011 2:19 am

RockerMan


WebArtz Technician
WebArtz Technician
After 2 years of education, I have learned that that !important is only to be used for de-bugging as further down the line it can prove a pain in the backside!

blindbat, I would also not suggest you use in-line it is very messy and un-practicle Smile

http://www.graphics-post.com/

4 Re: !important on Mon Mar 28, 2011 7:47 am

blindbat1457


Registered Member
Registered Member
I personally don't use inline styles just was an example. Yes you can use it for debugging but if all else fails and it isn't working you put !important you bet your ass it will work.

5 Re: !important on Mon Mar 28, 2011 8:49 pm

RockerMan


WebArtz Technician
WebArtz Technician
I never said It would not work, I just said it was in-practicle.

Say you have a paragraph tag and in your web-page you want all of them to be red and you used important
Code:
p { color: #FF0000 !important; }


Further down the line you wanted to add another paragraph inside a div with an id and wanted the text to be green you would normaly just have to use...
Code:
#licked p { color: #1CA600; }


But becuase you applied the important to all of the p tags earier in the CSS it wont work and you will think that you have done something wrong, when really you have not you have just applied an important tag

Hope this helps Smile

http://www.graphics-post.com/

6 Re: !important on Mon Apr 25, 2011 7:08 pm

RockerMan


WebArtz Technician
WebArtz Technician

Since an answer has been given to the original question I will mark this as solved and lock.

~ RockerMan

http://www.graphics-post.com/

View previous topic View next topic Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum