-1

How do I make border-radius in radio buttons? How do I apply border-radius to the box class?

.box {
  width: 300px;
  height: 60px;
  background: red;
  display: flex;
  align-items: center;
  border-radius: 50px;
}

.item {
  width: 100%;
  height: 100%;
  background: #000;
  display: flex;
  color: red;
  justify-content: center;
  align-items: center;
}

.item_active {
  background: gray;
}
<div class="box">
  <div class="item_active item">1</div>
  <div class="item">2</div>
  <div class="item">3</div>
</div>

I set it to 50px, but for some reason it doesn't work.

Rodrigo
  • 96
  • 1
  • 1
  • 7

1 Answers1

1

you need to add overflow hidden to .box class, so that the border radius cuts the underlaying content.

.box {
  width: 300px;
  height: 60px;
  background: red;
  display: flex;
  align-items: center;
  border-radius: 50px;
  overflow: hidden;
}
.item {
  width: 100%;
  height: 100%;
  background: #000;
  display: flex;
  color: red;
  justify-content: center;
  align-items: center;
}
.item_active {
  background: gray;
}
<div class="box">
  <div class="item_active item">1</div>
  <div class="item">2</div>
  <div class="item">3</div>
</div>
Andrei Voicu
  • 740
  • 1
  • 6
  • 13