Reputation: 81
I need to set background color to grey for each row with a space in between each row. My code below sets leaves no gap/space between the rows.
<table class="greydiag">
<tbody>
@foreach (var item in Model.project)
{
@:<tr style="background-color:grey; margin-bottom:10px">
<td class="position">@item["position"]</td>
<td class="image">
<img src="@item["image"]" />
</td>
<td class="name">@item["name"]</td>
@:</tr>
}
</tbody>
</table>
Upvotes: 1
Views: 82
Reputation: 99564
You could use border-spacing
property for the table
as follows:
table {
border-spacing: 0 8px; /* two-value syntax: horizontal vertical */
}
Note: make sure the table has border-collapse: separate;
.
Upvotes: 2