日期:2020-10-11
问题:必须选中一个而且只能选中其中一个
先看代码
<p>性别:
<input id="man" type="radio" checked="checked" name="sex"/>男
<input type="radio" id="woman" name="sex">女
</p>
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/7e7acb30b474fb76b756d74cf58596ac.png)
其中 type="radio"代表是 这种原点形式的选择键
checked="checked"为初始状态下默认选上
两个input的
name 相同是为了保证两个按钮为同一个“题”只能选择一个
id不同则代表这是两个选项