DEV Community

Cover image for Rounded edges on table rows
Temitope Ayodele
Temitope Ayodele

Posted on

21 1

Rounded edges on table rows

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.

tr{
  border-radius: 10px
}
Enter fullscreen mode Exit fullscreen mode

This wont work..

Instead do this:

// Set border-radius on the top-left and bottom-left of the first table data on the table row
td:first-child,
th:first-child {
  border-radius: 10px 0 0 10px;
}

// Set border-radius on the top-right and bottom-right of the last table data on the table row
td:last-child,
th:last-child {
  border-radius: 0 10px 10px 0;
}
Enter fullscreen mode Exit fullscreen mode

Checkout the codepen below

Top comments (2)

Collapse
 
mikaeljan profile image
Michal Janek

If you open this on Firefox you may notice a small border created right before the end of first cell and beginning of last.

Basically Safari adds a thin border even if you dont specify it if you apply rounded corners.
Any solutions to this ?

Collapse
 
garyskt profile image
Gary Calle

Muchas Gracias, me sirvio!

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Explore a sea of insights with this enlightening post, highly esteemed within the nurturing DEV Community. Coders of all stripes are invited to participate and contribute to our shared knowledge.

Expressing gratitude with a simple "thank you" can make a big impact. Leave your thanks in the comments!

On DEV, exchanging ideas smooths our way and strengthens our community bonds. Found this useful? A quick note of thanks to the author can mean a lot.

Okay