Skip to content Skip to sidebar Skip to footer

Css Border Radius And Border Collapse

I'm trying to have a table with a border-radius of 12px set in CSS. There is no border on the tr or td within the table, just the one border around the whole lot. I want the first

Solution 1:

Try this:

<table class="admin" style = "border-spacing:0px;">

Obviously you can pull that inline style out into its own class, but I wanted to explicitly show you that border-spacing on the table is what you're after.

You should/could add some padding to the content inside the table if you don't want the text to be snug against the table's border.

Solution 2:

Here is my css with fix:

table {
    border:1px solid black;
    border-radius: 5px; //Any radius you want. It will work perfectly!
    border-spacing: 0;
}
tabletd:first-child, tabletd:not(:first-child):not(:last-child){
    border-right:1px solid black;
}
tabletr:first-child td, tabletr:not(:last-child) td {
    border-bottom:1px solid black;
}

tabletheadtr:first-child  td:first-child {
    -webkit-border-top-left-radius: 2px;
    -moz-border-radius-topleft: 2px;
    border-top-left-radius: 2px;
}

tabletheadtr:first-child  td:last-child {
    -webkit-border-top-right-radius:2px;
    -moz-border-radius-topright: 2px;
    border-top-right-radius: 2px;
}
tabletbodytr:last-childtd:first-child {
    -webkit-border-bottom-left-radius: 2px;
    -moz-border-radius-bottomleft: 2px;
    border-bottom-left-radius: 2px;
}

tabletbodytr:last-childtd:last-child {
    -webkit-border-bottom-right-radius: 2px;
    -moz-border-radius-bottomright: 2px;
    border-bottom-right-radius: 2px;
}

Post a Comment for "Css Border Radius And Border Collapse"