Reputation: 251
I'm trying to give a color to the space between the rows.
This is the result:
http://gyazo.com/88b855df698f55d1e8c7350a31f4d51b
What I have done is the following:
#PersSchemaTable td:nth-child(1),
#PersSchemaTable td:nth-child(3),
#PersSchemaTable td:nth-child(5),
#PersSchemaTable td:nth-child(7),
#PersSchemaTable td:nth-child(9),
#PersSchemaTable td:nth-child(11),
#PersSchemaTable td:nth-child(13) {
border-right: 2px solid #781351;
}
As you can see there is still spacing between each row. Btw the table is made in php.
How can I color the space between the rows too?
Upvotes: 1
Views: 87
Reputation: 6796
Set the position
of your cells to relative
and then use an absolutely positioned pseudo element.
Here's a very rough example, assuming a 5px gap between your cells:
td{
position:relative;
}
td:nth-child(2n-1)::after{
background:red;
bottom:-5px;
content:"";
display:block;
position:absolute;
right:-2px;
top:-5px;
width:2px;
}
Upvotes: 1
Reputation: 3955
Give the entire table a background color and then assign each <td>
the background color you want them to be.
Upvotes: 6