Reputation: 10240
I have this table on this page of mine. Now I need a border radius on the table, so have have the following styles applied:
.toy-cart-table > thead > tr {
background: #f9bbcf;
border-radius: 10px;
/* padding-left: 2.00em; */
border: 1px solid #cccccc;
border-top-right-radius: 10px;
border-top-left-radius: 10px;
}
.toy-cart-table > thead > tr > th {
padding: 0.75em;
padding-left: 1.78em;
font-size: 1.12em;
border-top-right-radius: 10px;
border-top-left-radius: 10px;
/* border: 1px solid #cccccc; */
}
.toy-cart-table {
width: 100%;
/* border: 1px solid #cccccc; */
border-top-right-radius: 10px;
border-top-left-radius: 10px;
border-collapse: collapse;
}
<table class="toy-cart-table">
<thead>
<tr>
<th colspan="2">Toys to be Returned</th>
</tr>
</thead>
<tbody>
<tr>
<td><img src="images/res/toy-cart/1.png" alt="toy cart image"></td>
<td><p>Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat.</p></td>
</tr>
<tr>
<td><img src="images/res/toy-cart/2.png" alt="toy cart image"></td>
<td><p>Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat.</p></td>
</tr>
</tbody>
</table>
But even though I have border radius applied to the child and parent elements I still don't get rounded corners, why? my table still looks like the below:
Why am I not getting rounded corners?
I saw this thread but it's not really helpful.
Upvotes: 0
Views: 308
Reputation: 5794
You should remove border-collapse: collapse;
from toy-cart-table
.toy-cart-table > thead > tr {
background: #f9bbcf;
border-radius: 10px;
/* padding-left: 2.00em; */
border: 1px solid #cccccc;
border-top-right-radius: 10px;
border-top-left-radius: 10px;
}
.toy-cart-table > thead > tr > th {
padding: 0.75em;
padding-left: 1.78em;
font-size: 1.12em;
border-top-right-radius: 10px;
border-top-left-radius: 10px;
/* border: 1px solid #cccccc; */
}
.toy-cart-table {
width: 100%;
border: 1px solid #cccccc;
border-top-right-radius: 10px;
border-top-left-radius: 10px;
}
<table class="toy-cart-table">
<thead>
<tr>
<th colspan="2">Toys to be Returned</th>
</tr>
</thead>
<tbody>
<tr>
<td><img src="images/res/toy-cart/1.png" alt="toy cart image"></td>
<td><p>Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat.</p></td>
</tr>
<tr>
<td><img src="images/res/toy-cart/2.png" alt="toy cart image"></td>
<td><p>Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat.</p></td>
</tr>
</tbody>
</table>
Upvotes: 2
Reputation: 8349
wont work with
border-collapse: collapse;
use border-collapse: unset;
.toy-cart-table {
border: 1px solid #e8e8e8;
border-collapse: unset;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
width: 100%;
}
Upvotes: 1
Reputation: 133
I have to agree with the above answers. Rounded borders wont work with border-collapse: collapse;
. Try removing this style.
Upvotes: 0