tags:

views:

37

answers:

4

Hello,

I am using a table with 1 column and three rows. I would like to give all 3 rows a solid, continuous background color. How could I do this?

Thanks in advance,

John

    echo "<table class=\"samplesrec\">"; 

    echo '<tr class="class2">';
    echo '<td class="sitename1"></td>';
    echo '</tr>';

    echo '<tr>';
    echo '<td class="sitename2name"></td>';
    echo '</tr>';

    echo '<tr>';
    echo '<td class="sitename2"></td>';
    echo '</tr>';

    echo "</table>";
A: 
.sitename1
{
   background-color: xxx;
   border-left: 1px solid xxx;
   border-right: 1px solid xxx;
}

maybe?

James Connell
A: 

Wouldn't you just apply a background-color to your entire table? I don't have time to test, unfortunately.

.samplesrec{
  background-color:#XXX;
}
bikeboy389
+1  A: 

If you collapse the borders and put no spacing between it will make a solid background.

table {
    border-collapse:collapse;
    border-spacing:0;
}

http://jsfiddle.net/robert/HpQjd/

Robert
Thanks, but since this table is part of a PHP query, I want there to be white spacing between each result, one result being the three rows listed above.
John
I'm not exactly sure what you just said. Is a result a full table, or just a tr?
Robert
A: 

This will make the column have a blue background and black border on the sides.

.samplesrec
{
  border-collapse: collapse;
  border-spacing: 0px;
}

.samplesrec td
{
  border: 0px 1px;
  border-style: solid;
  border-color: #000000;
  background-color: #0000ff;
}
JungleFreak
Thanks... would this make a continuous background for the column through all three rows?
John
it should. gets rid of spacing and only has borders on the sides. You can mess with it to get it to look how you want. obviously the blue background won't do. :)
JungleFreak