0

I am trying to set up a background color outside of border-radius with :before and z-index.

The problem is that the border-radius css start should be a circle and behind on the right side should be light green to connect to the html element 2 but it does not work.

Any suggestion how to make it work?

td {
    width:40px;
    height:40px;
    text-align: center;
    background-clip: padding-box;
    -webkit-background-clip: padding-box;
}

.middle {
  background-color: #b2edd6;
}

td.start {
    border-radius: 50%;
    background-color: #00AA6C;
    color: white;
    z-index: 1;
    position: relative;
}

td.start:before {
  content: "";
  background-color: #b2edd6;
  width: 50%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 50%;
  z-index: -1;
}
<table style='table-layout:fixed;border-collapse: collapse;'>
  
  <tbody>
    <tr>
      <td class='start'>1</td>
      <td class='middle'>2</td>
      <td>3</td>
    </tr>
  </tbody>
</table>
Petr
  • 1,853
  • 2
  • 25
  • 49

0 Answers0