【发布时间】:2021-01-16 03:29:29
【问题描述】:
如何在单选按钮中添加border-radius?
如何将border-radius 应用于box 类?
.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>
我将它设置为50px,但由于某种原因它不起作用。
【问题讨论】:
-
你需要把radius放到item类中
-
这能回答你的问题吗? Should border-radius clip the content?