CSS TD element style overrides Table class style.

I've created the MyTableClass CSS class(stored in .CSS file)  and specified it to a HTML table.

.MyTableClass

{

font-size: 8pt;

}

 

However the size of font inside the table was bigger than I specified.

Thanks to VS 2008 CSS properties pane - Applied Rules section I was able to find that the rule was overridden by TD element style

TD

{

font-size: 12px;

}

 

It was not hard to create hack to override global TD.

.MyTableClass TD

{

font-size: 8pt;

}

 

I feel that having global element rule is not a good idea.

Unfortunately I am scared to change the style, because it is used in many places in production.

Update: I found very similar post Tackling Stubborn TD Style Definitions, written by Jovan.    

Related articles:

CSS Style Table - styling tables with only one class 

My post Adaping CSS and Javascript from Html Prototype. 

 

posted @ Thursday, November 06, 2008 11:11 PM

Print

Comments on this entry:

No comments posted yet.

Your comment:



 (will not be displayed)


 
 
 
 
 

Live Comment Preview:

 
«March»
SunMonTueWedThuFriSat
28123456
78910111213
14151617181920
21222324252627
28293031123
45678910