来源:自学PHP网 时间:2018-02-08 10:48 作者: 阅读:次
[导读] CSS :checked伪类用于匹配被用户选中的单选按钮Radio或复选按钮checkbox。...
|
CSS
你可以在
<input type="radio" checked>
<input type="checkbox" checked>
<select name="options" id="list">
<option value="Something" selected>This option is selected</option>
<option value="Something-else">This one is not</option>
</select>
单选按钮和复选按钮默认为
<input type="checkbox" id="todo"> <label for="todo">是否选中?</label>
input[type = "checkbox"]:checked + label {
color: red;
}
得到的结果如下: 示例代码
/* 表示页面上的所有选中的radio按钮 */
input[type="radio"]:checked{
width: 20px;
height: 20px;
}
/* 表示页面上的所有选中的checkbox按钮 */
input[type="checkbox"]:checked{
color: red;
}
/* 表示页面上的所有选中的select的选项 */
option:checked{
color: green;
}
在线演示下面的例子使用 浏览器支持所有的现代浏览器都支持 |
自学PHP网专注网站建设学习,PHP程序学习,平面设计学习,以及操作系统学习
京ICP备14009008号-1@版权所有www.zixuephp.com
网站声明:本站所有视频,教程都由网友上传,站长收集和分享给大家学习使用,如由牵扯版权问题请联系站长邮箱904561283@qq.com