相关疑难解决方法(0)

如何使用CSS设置复选框的样式?

我正在尝试使用以下方式设置复选框的样式:

<input type="checkbox" style="border:2px dotted #00f;display:block;background:#ff0000;" />
Run Code Online (Sandbox Code Playgroud)

但风格并未适用.该复选框仍显示其默认样式.我如何给它指定的样式?

html css checkbox

788
推荐指数
21
解决办法
158万
查看次数

在firefox中设置一个复选框样式 - 删除检查和边框

如何设置firefox中的复选框样式,并使复选标记和边框消失?

http://jsfiddle.net/moneylotion/qZvtY/

CSS:

body { background: black; }
#conditions-form { color: white; }
#conditions-form input[type=checkbox] {
    display:inline-block;
    -webkit-appearance: none;
    -moz-appearance: none;
    -o-appearance:none;
    appearance: none;
    width:19px;
    height:19px;
    background: url('http://demo.somedomain.com/wp-content/themes/themename/images/care-plan-checkbox.gif') no-repeat top left;
    cursor:pointer;
}
#conditions-form input[type=checkbox]:checked {
    background:url('http://demo.somedomain.com/wp-content/themes/themename/images/care-plan-checkbox-checked.gif') no-repeat top left;
}
Run Code Online (Sandbox Code Playgroud)

HTML:

<form id="conditions-form">
    <ul>
        <li>
            <input id="condition3" type="checkbox" name="conditions[condition3]"></input>
            <label class="checkbox" for="condition3">Conditions 3</label>
        </li>
    </ul>
</form>
Run Code Online (Sandbox Code Playgroud)

html css firefox

16
推荐指数
3
解决办法
4万
查看次数

如何在图像上显示复选框以供选择?

我想在每张图片的右下角显示一个复选框供选择.

我该怎么做这样的事情?

请记住,点击图片有一个独特的事件(我将设法做!),但点击该复选框应选择/取消选择那个?

html css

8
推荐指数
2
解决办法
3万
查看次数

用图标替换复选框元素

我想自定义浏览器复选框。当状态被选中时,应该显示 图标,checked.svg而不是复选框和图标unchecked.svg

这是我的代码。HTML:

<div class="checkbox-custom">
   <input type="checkbox"/>
      <div class="checkmark">
          <img src="@/assets/images/icons/checkbox/unchecked.svg" class="unchecked"/>
          <img src="@/assets/images/icons/checkbox/checked.svg" class="checked"/>
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

SAS:

.checkbox-custom {
    position: absolute;
    width: 28px;
    height: 28px;
    left: 0;
    top: 0;

    // Hide default browser checkbox
    input[type=checkbox] {
                display: none;
            }

   input[type=checkbox] + .checkmark {
        position: absolute;
        left: 3.5px;
        top: 3.5px;
        right: 3.5px;
        bottom: 3.5px;

        display: inline-block;
        cursor: pointer;

        img {
            width: 21px;
            height: 21px;
        }

        .checked {
            display: none;
        }
    }    

    input[type=checkbox]:checked + .checkmark {
        .checked …
Run Code Online (Sandbox Code Playgroud)

html css checkbox sass

5
推荐指数
2
解决办法
3万
查看次数

标签 统计

css ×4

html ×4

checkbox ×2

firefox ×1

sass ×1