Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Giving table rows a solid, continuous background color

Tags:

css

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>";
like image 378
John Avatar asked Jan 22 '23 06:01

John


2 Answers

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/

like image 65
Robert Avatar answered Feb 20 '23 02:02

Robert


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;
}
like image 33
Rohrbs Avatar answered Feb 20 '23 01:02

Rohrbs