Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Border radius html table

I've been trying to apply some rounded corners to a table of mine, but I just can't seem to get it right. My table is being collapsed, once the <thead>is clicked on. The <thead>need to only have top rounded corners, while the last <tr> element needs to only have bottom rounded corners. I'm using bootstrap as a framework.

Currently my design look like this:

Current header

Current last element

I want my <head> to look like this:

enter image description here

while the last element still have bottom rounded corners.

table.html

<table align="center" class="table table-curved" id="nextTeamTable">     <thead data-parent="#bodyContainer" data-toggle="collapse" data-target="#tbodyCollapse">         <tr>             <th>HeadTitle</th>         </tr>     </thead>     <tbody class="collapse" id="tbodyCollapse">         <tr>             <td>Body1</td>             <td>Body2</td>             <td>Body3</td>         </tr>     </tbody> </table> 

table.css

.table-curved {     border-collapse:separate;     border: solid #ccc 1px;     border-radius: 25px; }  .table-curved tr:last-child td {     border-bottom-left-radius: 25px;         border-bottom-right-radius: 25px;    } 
like image 290
Niels Sønderbæk Avatar asked Nov 17 '13 20:11

Niels Sønderbæk


People also ask

How do I make my table border rounded in HTML?

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

How do you add a border radius to a table tr?

To add border radius to a table row tr , you have to specifically target the first table data td on the row and the last. This Pen is owned by Temitope Ayodele on CodePen.


1 Answers

EDIT - Try this: Put overflow:hidden on the .tabled-curved with the border-radius: 25px;. Then just Remove the rest of the border-radius CSS

like image 128
Mike Barwick Avatar answered Sep 22 '22 21:09

Mike Barwick