我正在尝试实现背景转换,当您单击选项卡时,当前选项卡的背景会滑动到单击的选项卡。任何人都可以帮忙吗?
*,
*:before,
*:after {
box-sizing: border-box;
}
.radio_wrap {}
input {
position: absolute;
opacity: 0;
}
label {
min-width: calc(100% / 4);
position: relative;
float: left;
text-align: center;
text-shadow: none;
padding: 20px;
border: 1px solid #dfe0e4;
color: grey;
font-size: 14px;
position: relative;
transition: background-color .3s ease-in-out;
}
input:checked+label {
background: grey;
color: white;
}Run Code Online (Sandbox Code Playgroud)
<div class="radio_wrap">
<input type="radio" id="radio1" name="radio1">
<label for="radio1">tab1</label>
<input type="radio" id="radio2" name="radio1">
<label for="radio2">tab2</label>
<input type="radio" id="radio3" name="radio1">
<label for="radio3">tab3</label>
<input type="radio" id="radio4" name="radio1">
<label …Run Code Online (Sandbox Code Playgroud)我需要在 SVG 内的文本元素周围环绕背景,它需要有填充和边框半径。问题是文本将是动态的,所以我需要背景来扩大文本的宽度。我找到了一个使用外来对象的解决方案,但这在 IE 11 中不受支持,这是一个问题。任何人都可以提出解决方法。