tags:

views:

15

answers:

2

If I am assigning a paricular css class to a control ,it hnherits the class but if i simultaneously give the skin id to the same control then this skin ID overrides the CSS class. Why this is happening?

Now if I am using !important in the css stylesheets then css class property is inherited by the control. .lblUserName1 { width: 400px; line-height: 32px; color: Red !important; font-weight: bold; background-color: #669999; } Please help me...Its creating a heap of confusion..

+1  A: 

Skin probably uses inline CSS in style attribute of your control this way due to CSS herarchy what you define in skin theme will override what you have defined in class which resides external .css file.

Best way to debug CSS and HTML is viewing the code itself.

eugeneK
You didnt tellanything about the !important which when i m using in the CSS class in the corresponding property for the control,then inspite of taking the skin ID property it takes CSS class property..
Srivastava
@Srivastava, i don't know what exactly you did override with !important tag. !important would override css property on the same hierarchy level, if you set these on different levels result may vary. Try to avoid using !important especially when you don't know how Skins in ASP.NET set css properties.
eugeneK
+1  A: 

You should avoid using !important; were you can. Basically it is recommended that you use it only when you are overriding some pre-loaded styles that you can't really change.

ID is basically superior to class. Check the answer marked as correct here: CSS class priorities

jayarjo