【发布时间】:2017-09-21 04:56:12
【问题描述】:
我想要一个绿色单选按钮,当我选择它时,它被绿色边框包围。
这就是我所拥有的:
input[type='radio'] {
-webkit-appearance: none;
width: 10px;
height: 10px;
border-radius: 50%;
outline: none;
box-shadow: 0 0 0 2px gray;
}
input[type='radio']:before {
content: '';
display: block;
width: 60%;
height: 60%;
margin: 20% auto;
border-radius: 50%;
}
input[type='radio']:checked:before {
background: green;
}
.role {
margin-right: 80px;
margin-left: 20px;
font-weight: normal;
}
.checkbox label {
margin-bottom: 20px !important;
}
.roles {
margin-bottom: 40px;
}
还有模板:
<div class="roles">
<input type="radio" name="role" value="ONE" id="one">
<label class="role" for="one">ONE</label>
<input type="radio" name="role" value="TWO" id="two">
<label class="role" for="two">TWO</label>
</div>
这是一个 Jsfiddle:Demo
就像您可以看到 border-color 永远不会变为绿色...我尝试添加 border-color 属性无济于事...我该怎么做?
谢谢!
【问题讨论】:
-
你可以在这里找到解释:) stackoverflow.com/questions/4253920/…
标签: css radio-button