我只想显示选中输入的内容,并且一次只能选中一个输入。我只想知道如何取消选中以前选中的输入,以便一次只有一个输入保持选中状态。我想这个功能只使用css,而不是js。我知道如何在js中做到这一点。这是我的代码。
input {
display: none;
}
.content {
padding: 5px 0px;
margin: 0 0 1px 0;
border-radius: 3px;
color: hsl(240, 6%, 50%);
font-size: 14px;
overflow: hidden;
height: 0;
opacity: 0;
transition: height 0.4s, opacity 0.4s;
}
input:checked ~ .content {
height: 60px;
opacity: 1;
}Github repo:https://github.com/rishipurwar1/faq-accordion-card-main
发布于 2020-12-28 17:08:31
发布于 2020-12-28 17:45:24
尝尝这个
<input type="radio" id="" name="" value="">https://stackoverflow.com/questions/65475126
复制相似问题