©
This document uses PHP Chinese website manual Release
E:checked { sRules }
IE | Firefox | Chrome | Safari | Opera | iOS Safari | Android Browser | Android Chrome |
---|---|---|---|---|---|---|---|
6.0-8.0 | 2.0+ | 4.0+ | 3.1+ | 3.5+ | 3.2+ | 2.1+ | 18.0+ |
IE9.0+ |
<!DOCTYPE html> <html lang="zh-cmn-Hans"> <head> <meta charset="utf-8" /> <title>用户界面(UI)元素状态伪类选择符 E:checked_CSS参考手册_web前端开发参考手册系列</title> <meta name="author" content="Joy Du(飘零雾雨), dooyoe@gmail.com, www.doyoe.com" /> <style> input:checked + span { background: #f00; } input:checked + span:after { content: " 我被选中了"; } </style> </head> <body> <form method="post" action="#"> <fieldset> <legend>选中下面的项试试</legend> <ul> <li><label><input type="radio" name="colour-group" value="0" /><span>蓝色</span></label></li> <li><label><input type="radio" name="colour-group" value="1" /><span>红色</span></label></li> <li><label><input type="radio" name="colour-group" value="2" /><span>黑色</span></label></li> </ul> </fieldset> <fieldset> <legend>选中下面的项试试</legend> <ul> <li><label><input type="checkbox" name="colour-group2" value="0" /><span>蓝色</span></label></li> <li><label><input type="checkbox" name="colour-group2" value="1" /><span>红色</span></label></li> <li><label><input type="checkbox" name="colour-group2" value="2" /><span>黑色</span></label></li> </ul> </fieldset> </form> </body> </html>
点击 "运行实例" 按钮查看在线实例