<!-- Radio Button Example -->
<form>
<fieldset>
<legend>Choose your favorite color:</legend>
<!-- Each radio button has the same name attribute, so they are part of the same group -->
<input type="radio" id="red" name="color" value="red">
<label for="red">Red</label><br>
<input type="radio" id="green" name="color" value="green">
<label for="green">Green</label><br>
<input type="radio" id="blue" name="color" value="blue">
<label for="blue">Blue</label><br>
</fieldset>
</form>
<!-- Explanation:
- The 'input' element with 'type="radio"' creates a radio button.
- The 'name' attribute groups the radio buttons together, so only one can be selected at a time.
- The 'id' attribute is used to link the label to the radio button using the 'for' attribute in the label tag.
- The 'value' attribute specifies the value that will be sent when the form is submitted.
-->
上一篇:html网页代码生成器
下一篇:html常用标记有哪些
Laravel PHP 深圳智简公司。版权所有©2023-2043 LaravelPHP 粤ICP备2021048745号-3
Laravel 中文站