user3288249
user3288249

Reputation: 81

space between each row

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

Answers (1)

Hashem Qolami
Hashem Qolami

Reputation: 99564

You could use border-spacing property for the table as follows:

table {
    border-spacing: 0 8px; /* two-value syntax: horizontal vertical */
}

WORKING DEMO.

Note: make sure the table has border-collapse: separate;.

Upvotes: 2

Related Questions