Mr.Chowdary Mr.Chowdary - 1 year ago 76
CSS Question

bgcolor to the th of table with width 70% possible in a table

I want to give bgcolor to the th attribute only with width 70%.

Header is like "Mega Event Offer". I want to give background color to that only. But it's width is big. SO it is exceeding the heading also.. Can we do it? I googled.. But no use..

Any idea?

Answer Source

Not sure I fully understand the problem here, but given that you want to apply the background only behind the text and not on the entire th-element, I guess you could wrap the text in a span-element and apply the background-color to that instead of the entire th-element.

Something like this:


     <span class="mega-event">Mega Event Offer</span>


.mega-event {
   background-color: #888;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download