79568884

Date: 2025-04-11 12:55:39
Score: 1
Natty:
Report link

According to the CSS specification, the border-radius property only applies to block-level elements, and table or tr elements are not considered block-level :(

Many of the suggested solutions work just fine, but I'd like to suggest wrapping the table in a container element (e.g., div) and apply the border radius to the wrapper.

<div class="my-table-wrapper">
  <table class="my-table">
    <!--  -->
  </table>
</div>
.my-table-wrapper {
  border-collapse: separate;
  border-radius: 4px;
  border: 1px solid #F1F1F1;
  overflow: hidden;
}

.my-table {
  border-spacing: 0;
  border-collapse: separate;
}
Reasons:
  • Blacklisted phrase (1): :(
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Romain Hoarau