Forum Moderators: not2easy

Message Too Old, No Replies

Overriding div style for tables with class

         

smallcompany

5:23 am on Jan 15, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I have

#main table {
border: 2px solid #CCCCCC;
background: #FFFFFF;
border-collapse: collapse;
font-size: 80%;
text-align: center;
}

and then

.nothing {
border: none;
vertical-align: top;
background: none;
text-align: left;
}

If I assign class "nothing" to the table inside div "main", nothing is affected by the class.

I tried playing with

table .no
#main table .no
...and so on...

no luck

What's my problem?

Thanks

smallcompany

5:59 am on Jan 15, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Figured!

It's amazing how being addicted to WebmasterWorld can also be translated as lazy.

I obviously haven't tried all combinations, due to the lack of knowledge.
On the other side, this hard way is sometimes the best to teach you.

Anyway...

#main table.nothing did it.

It happened after I took a better look into div setting and figured I should follow the order.

At the end, my few searches about divs and classes did not give much of results.
Plus if you search something like "table div class..." you always get something about table and css layout, not actually about real tables controlled via css.

Any good resource to be bookmarked?

Thanks

Drag_Racer

5:39 am on Jan 18, 2010 (gmt 0)

10+ Year Member



it has to do with how specific your "selectors" are...

'#main table' is more specific than '.nothing'

ID (#) is more specific than a CLASS (.) selector.

2 selectors (#main table) are more specific than 1 selector (.nothing)

[google.com...]