【发布时间】:2011-12-29 11:53:41
【问题描述】:
我想将复选框显示为切换按钮。但我无法使用 CCS 将我的自定义图片应用于它——仍然绘制了复选框。如何完成这项任务?
我的 CSS:
input[type=checkbox]#settingsbutton {
border-style: none;
background-color: transparent;
width: 42px;
height: 40px;
display: block;
}
input[type=checkbox].button-settings {
background-image: url("images/button-settings-normal.png");
}
input[type=checkbox].button-settings:active {
background-image: url("images/button-settings-normal.png");
}
input[type=checkbox].button-settings:hover {
background-image: url("images/button-settings-hover.png");
}
input[type=checkbox].button-settings:active {
background-image: url("images/button-settings-pressed.png");
}
我的 HTML:
<body>
<input type="checkbox" id="settingsbutton" class="button-settings"/>
</body>
【问题讨论】:
标签: html css checkbox custom-controls