-1

Border radius not working, when I set in table row. I want the corners of each row to be rounded.

<table style="border-spacing: 0 8px; border-collapse: separate;">
                    <tbody>
                        @foreach (var item in Model.project)
                        {
                            @:<tr style="background-color:grey;-moz-border-radius: 15px;border-radius: 15px;">
                            <td class="position">@item["position"]</td>                                
                            <td class="image">
                                <img src="@item["image"]" />
                            </td>
                            <td class="name">@item["name"]</td>                              
                            @:</tr>
                        }
                    </tbody>
                </table>

2 Answers2

0

I have no idea what all of this code with @ is, I left that in the code and fixed the rest:

HTML:

<table style="border-spacing: 0 8px; border-collapse: separate;">
    <tbody>
    @foreach (var item in Model.project) {
        @:<tr>
            <td class="position">@item["position"]</td>                                
            <td class="image">
            <img src="@item["image"]" />
            </td>
            <td class="name">@item["name"]</td>                              
        @:</tr>
    }
    </tbody>
</table>

CSS:

tbody > tr td {
    background-color:grey;
    -moz-border-radius: 15px;
    border-radius: 15px;
}

JSFiddle demo

Daan
  • 2,680
  • 20
  • 39
  • http://jsfiddle.net/F6mZL/1/ That's how it would look like without the code with @ in front of it. – Daan Feb 20 '14 at 10:39
0

Try this css for table -

table {border-collapse:separate;}
tr:first-child td:first-child {border-top-left-radius:15px;}
tr:first-child td:last-child {border-top-right-radius:15px;}
tr:last-child td:first-child {border-bottom-left-radius:15px}
tr:last-child td:last-child {border-bottom-right-radius:15px;}
td {border:1px solid #000; background-color:#ccc}
Rohit Suthar
  • 3,528
  • 1
  • 42
  • 48