CSS :checked选择器,单选按钮和复选框

:checked选择器

CSS伪类选择器“:checked”可用于选择被选中input元素,如单选按钮radio和复选框checkbox,并根据实际需求来设置样式。


:checked选择器用法

A:checked {样式设置}

:checked选择器实例代码,及在线编辑器

<span>单选按钮 </span><input type='radio' id='e1'><br>
<span>复选框 </span><input type='checkbox' id='e2'>

<style>
  #e1:checked{width:50px;height:50px;}
  #e2:checked{width:20px;height:20px;}
</style>

全栈前端 / CSS教程 :



























Copyright © 2022-2024 笨鸟工具 x1y1z1.com All Rights Reserved.