【发布时间】:2014-07-26 05:00:39
【问题描述】:
单击框后,我正在尝试通过 CSS 删除应用于复选框的悬停类。 有人知道怎么做吗?
JSFiddle http://jsfiddle.net/sa9fe/
复选框代码为:
<div>
<input type="checkbox" id="checkbox-1-1" class="regular-checkbox flaticon-boxing3" />
<input type="checkbox" id="checkbox-1-2" class="regular-checkbox" />
<input type="checkbox" id="checkbox-1-3" class="regular-checkbox" />
<input type="checkbox" id="checkbox-1-4" class="regular-checkbox" />
</div>
复选框的CSS如下:
.regular-checkbox {
vertical-align: middle;
text-align: center;
margin-left: auto;
margin-right: auto;
align: center;
color: #39c;
width: 140px;
height: 140px;
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
border-radius: 6px;
background-color: #fff;
border: solid 1px #ccc;
-webkit-appearance: none;
background-color: #fff;
display: inline-block;
position: relative;}
.regular-checkbox:checked {
background-color: #39c;
color: #fff !important;}
.regular-checkbox:hover {
background-color: #f0f7f9;}
.regular-checkbox:checked:after {
color: #fff;
position: absolute;
top: 0px;
left: 3px;
color: #99a1a7; }
有什么建议吗?
还有人知道如何更改高光,因为目前它似乎以 3px 的边界半径突出框的边缘,而我使用的框是 6px。
【问题讨论】:
-
看到您可以创建一个 jsFiddle 以便我们查看您的代码并提供帮助吗?
-
@ElendilTheTall 您链接到的帖子涉及 jQuery,而这里的 OP 询问的是 CSS 问题。
-
@seangeraghty 目前尚不清楚预期的结果是什么。您的代码似乎没有尝试对已检查和悬停的元素进行样式设置。您是否在问如何链接伪选择器?只需尝试
checked:hover。 -
@Boaz 请在此处查看 JSFiddle:jsfiddle.net/sa9fe