View Full Version : Table Cell BG Color With CSS
jillymo
July 12th, 2007, 09:50 AM
Can I set specific cells of a table to be a different color using css? I have looked through this and other forums and am not coming across this specific issue. It seems maybe the entire table has to be set to the same bg color. Also if the table is already created with html is it going to have to be recreated or can I just add this as a style?
brndn
July 12th, 2007, 09:51 AM
<style type="text/css">
td.datacellone {
background-color: #CC9999; color: black;
}
td.datacelltwo {
background-color: #9999CC; color: black;
}
</style>
<table>
<tr><td class="datacellone">One</td><td class="datacellone">Fish</td></tr>
<tr><td class="datacelltwo">Two</td><td class="datacelltwo">Fish</td></tr>
<tr><td class="datacellone">Red</td><td class="datacellone">Fish</td></tr>
<tr><td class="datacelltwo">Blue</td><td class="datacelltwo">Fish</td></tr>
</table>
jillymo
July 12th, 2007, 10:23 AM
Wow that was very fast, thank you so much
brndn
July 13th, 2007, 10:11 AM
yeh i just googled "table cell colour css" and that was the first result.:ninja:
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.