Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I make a table line with rounded corners?

Tags:

css

I've been using HTML and CSS to style my resume, but I'm having difficulties styling a <tr> element.

Does this not work inside a table ?

-moz-border-radius: 5x;
-webkit-border-radius: 5px;
like image 669
Manu Avatar asked Feb 04 '10 09:02

Manu


People also ask

Can you make a table with rounded corners in Word?

Click the Insert > Shapes button and choose the Rounded Rectangle tool.

How do I make my table border rounded?

Use the CSS border-radius property to add rounded corners to the table cells.


1 Answers

Yes, it works inside a table on td and th elements, but not on tr. You can also use it on table to round the corners of the whole table.

If you want to round a row of cells so that the left- and rightmost elements are rounded, you need to use the :first-child and :last-child pseudo classes:

tr td:first-child {
    -moz-border-radius-topleft: 5px;
    -moz-border-radius-bottomleft: 5px;
    -webkit-border-top-left-radius: 5px;
    -webkit-border-bottom-left-radius: 5px;

}

tr td:last-child {
    -moz-border-radius-topright: 5px;
    -moz-border-radius-bottomright: 5px;
    -webkit-border-top-right-radius: 5px;
    -webkit-border-bottom-right-radius: 5px;
}

first-child is not supported by IE6, and while IE7 adds support for it, it still lacks last-child. But that doesn't matter in your case as border-radius wouldn't work in those browsers anyway.

like image 59
Tatu Ulmanen Avatar answered Sep 22 '22 15:09

Tatu Ulmanen