html <Label>标签包含checkbox可按文字就选中

本文探讨了网站登录界面中“记住我”功能的实现方式及其背后的原理。解释了如何通过复选框让用户选择是否保存登录状态,并介绍了这一功能对于用户体验的重要性。
<label>
    <input type="checkbox"> Remember me

</label>

本关任务:完成一个表单的创建任务。 这里标签要按照规定格式来写,因为有 <div> 标签,会自动换行,就不用 <br> 标签了。 属性的先后顺序为: type -- id -- class -- name -- value ,其他需要添加的属性最后写。 其他要求如下: • 用户名:添加类 .common ; • 昵称:添加类 .common ; • 性别: name 属性的值为 sex ,禁用保密; • 男: <label> 标签的 for 属性的值为 male ; • 女: <label> 标签的 for 属性的值为 female ; • 保密: <label> 标签的 for 属性的值为 other ; • 教育程度:添加类 .common ,默认选中本科; • 选项有: 高中,中专,大专,本科,硕士,博士,其他 ; • 婚姻状况: name 属性的值为 state ,默认选中未婚; • 未婚: <label> 标签的 for 属性的值为 single ; • 已婚: <label> 标签的 for 属性的值为 married ; • 保密: <label> 标签的 for 属性的值为 secret ; • 兴趣爱好: name 属性的值为 hobby ,默认选中看电影; • 踢足球: <label> 标签的 for 属性的值为 football ; • 打篮球: <label> 标签的 for 属性的值为 basketball ; • 看电影: <label> 标签的 for 属性的值为 film ; • 描述自己的特点:添加类 .common ,字符最大长度为 20 ; • 提交:添加空 <span></span> ,用来占位,添加类 .common , value 值为 提交 。 要求:像“用户名、昵称”这些采用 <span> 标签包裹文本,而‘男、女’这些单选框和多相框采用 <label> 标签包裹文本。 效果如下: 下拉框:
最新发布
10-30
<h1>注册信息</h1> <form action="action_page.php" method="get"> <label>姓名:</label><input type="text" placeholder="请输入真实姓名"> <br></br> <label>密码:</label><input type="password" placeholder="请输入密码"> <br></br> <label>确认密码:</label><input type="password" placeholder="请输入确认密码"> <br></br> <label>性别:</label> <label><input type="radio" name="gender"> 男</label> <label><input type="radio" name="gender" checked> 女</label> <br></br> <label>居住城市:</label> <select> <option>北京</option> <option>上海</option> <option>广州</option> <option>深圳</option> <option>武汉</option> </select> <h2>教育经历</h2> <label>最高学历:</label> <select> <option>博士</option> <option>硕士</option> <option>本科</option> <option>大专</option> </select> <br></br> <label>学校名称:</label><input type="text"> <br></br> <label>所学专业:</label><input type="text"> <br></br> <label>在校时间:</label> <select> <option>2015</option> <option>2016</option> <option>2017</option> <option>2018</option> </select> <br></br> <select> <option>2019</option> <option>2020</option> <option>2021</option> <option>2022</option> </select> <br></br> <h2>工作经历</h2> <label>公司名称:</label><input type="text"> <br></br> <label>工作描述:</label> <br> <textarea></textarea> <br></br> <input type="checkbox"><label>已阅读并同意以下协议:</label> <ul> <li><a href="#">《用户服务协议》</a></li> <li><a href="#">《隐私政策》</a></li> </ul> <br></br> <button>免费注册</button> <button type="reset">重新填写</button> </form>
04-03
<!DOCTYPE html><br/><html lang="zh"><br/><head><br/> <meta charset="UTF-8" /><br/> <meta name="viewport" content="width=device-width, initial-scale=1.0"/><br/> <title>征婚网注册</title><br/> <style><br/> body {<br/> font-family: "Microsoft YaHei", sans-serif;<br/> background-color: #f5f5f5;<br/> display: flex;<br/> justify-content: center;<br/> align-items: center;<br/> height: 100vh;<br/> margin: 0;<br/> }<br/> .form-container {<br/> width: 400px;<br/> padding: 30px;<br/> background: white;<br/> border-radius: 10px;<br/> box-shadow: 0 4px 10px rgba(0,0,0,0.1);<br/> }<br/> h2 {<br/> text-align: center;<br/> color: #d63384;<br/> }<br/> .input-group {<br/> margin-bottom: 15px;<br/> }<br/> label {<br/> display: block;<br/> margin-bottom: 5px;<br/> font-weight: bold;<br/> }<br/> input[type="text"], input[type="tel"], select {<br/> width: 100%;<br/> padding: 8px;<br/> border: 1px solid #ccc;<br/> border-radius: 5px;<br/> }<br/> .checkbox-group {<br/> display: flex;<br/> flex-wrap: wrap;<br/> gap: 10px;<br/> }<br/> .checkbox-item {<br/> display: flex;<br/> align-items: center;<br/> }<br/> .checkbox-item input {<br/> margin-right: 5px;<br/> }<br/> .btn-group {<br/> display: flex;<br/> justify-content: space-between;<br/> margin-top: 20px;<br/> }<br/> button {<br/> padding: 10px 20px;<br/> border: none;<br/> border-radius: 5px;<br/> cursor: pointer;<br/> }<br/> .reset-btn {<br/> background: #6c757d;<br/> color: white;<br/> }<br/> .login-btn {<br/> background: #d63384;<br/> color: white;<br/> }<br/> </style><br/></head><br/><body><br/><div class="form-container"><br/> <h2>征婚网</h2><br/> <div class="input-group"><br/> <label>性别:</label><br/> <div><br/> <input type="radio" id="male" name="gender" value="男" checked /><br/> <label for="male">男</label><br/> <input type="radio" id="female" name="gender" value="女" /><br/> <label for="female">女</label><br/> </div><br/> </div><br/> <div class="input-group"><br/> <label>出生年月:</label><br/> <select style="width: 32%; display: inline-block;"><br/> <option>请选择年</option><br/> <!-- 年份循环 --><br/> <script><br/> const year = new Date().getFullYear();<br/> for (let i = year; i >= 1950; i--) {<br/> document.currentScript.previousElementSibling.innerHTML += `<option>${i}</option>`;<br/> }<br/> </script><br/> </select><br/> <select style="width: 30%; display: inline-block;"><br/> <option>请选择月</option><br/> <script><br/> for (let i = 1; i <= 12; i++) {<br/> document.currentScript.previousElementSibling.innerHTML += `<option>${i}</option>`;<br/> }<br/> </script><br/> </select><br/> <select style="width: 30%; display: inline-block;"><br/> <option>请选择日</option><br/> <script><br/> for (let i = 1; i <= 31; i++) {<br/> document.currentScript.previousElementSibling.innerHTML += `<option>${i}</option>`;<br/> }<br/> </script><br/> </select><br/> </div><br/> <div class="input-group"><br/> <label>所在地区:</label><br/> <input type="text" value="奋斗者之家" readonly /><br/> </div><br/> <div class="input-group"><br/> <label>婚姻状况:</label><br/> <div><br/> <input type="radio" id="single" name="status" value="单身" checked /><br/> <label for="single">单身</label><br/> <input type="radio" id="unmarried" name="status" value="未婚" /><br/> <label for="unmarried">未婚</label><br/> <input type="radio" id="divorced" name="status" value="离异" /><br/> <label for="divorced">离异</label><br/> </div><br/> </div><br/> <div class="input-group"><br/> <label>学历:</label><br/> <input type="text" value="小学" readonly /><br/> </div><br/> <div class="input-group"><br/> <label>月薪:</label><br/> <input type="text" value="1000~100000" readonly /><br/> </div><br/> <div class="input-group"><br/> <label>手机号:</label><br/> <input type="tel" placeholder="请输入手机号" /><br/> </div><br/> <div class="input-group"><br/> <label>昵称:</label><br/> <input type="text" placeholder="请输入昵称" /><br/> </div><br/> <div class="input-group"><br/> <label>喜欢的类型:</label><br/> <div class="checkbox-group"><br/> <div class="checkbox-item"><input type="checkbox" /> <label>爱打篮球</label></div><br/> <div class="checkbox-item"><input type="checkbox" /> <label>温柔</label></div><br/> <div class="checkbox-item"><input type="checkbox" /> <label>可爱</label></div><br/> <div class="checkbox-item"><input type="checkbox" /> <label>小鲜肉</label></div><br/> <div class="checkbox-item"><input type="checkbox" /> <label>御姐</label></div><br/> <div class="checkbox-item"><input type="checkbox" /> <label>萝莉</label></div><br/> </div><br/> </div><br/> <div class="input-group"><br/> <label>自我介绍:</label><br/> <textarea rows="3" style="width:100%; padding:8px; border:1px solid #ccc; border-radius:5px;" placeholder="请填写自我介绍"></textarea><br/> </div><br/> <div class="input-group"><br/> <div><input type="checkbox" checked /> 我承诺年满18岁、单身</div><br/> <div><input type="checkbox" checked /> 抱着严肃的态度</div><br/> <div><input type="checkbox" checked /> 真诚寻找另一半</div><br/> <div><input type="checkbox" /> 我同意注册条款和会员加入标准</div><br/> </div><br/> <div class="btn-group"><br/> <button class="reset-btn">RESET</button><br/> <button class="login-btn">登录</button><br/> </div><br/></div><br/></body><br/></html>
10-30
``` <form action="xxx.jsp" method="GET" name="性别;生日;所在地区;婚姻状况;学历;喜欢的类型;自我介绍;"> <table width="500"> <style> body{ display:grid; place-content: center; height: 100vh; margin: 0%; font-family: '黑体'; font-size: 100px; } </style> <tr> <td><b>性别</b></td> <td> <input type="radio" id="man" name="sex"/> <label for="man"><img src="images/man.jpg"> 男 </label> <input type="radio" id="women" name="sex"/> <label for="women"><img src="images/women.jpg"> 女 </label> </td> </tr> <tr> <td><b>生日</b></td> <td> <select name="year"> <option selected="selected">--请选择年--</option> <option>1990</option> <option>2000</option> <option>2010</option> </select> <select name="month"> <option selected="selected">--请选择月--</option> <option>1</option> <option>2</option> <option>3</option> </select> <select name="day"> <option selected="selected">--请选择日--</option> <option>11</option> <option>12</option> <option>13</option> </select> </td> </tr> <tr> <td><b>所在地区</b></td> <td> <input type="text" value="安徽" name="area"> </td> </tr> <tr> <td><b>婚姻状况</b></td> <td> <input type="radio" name="marital_status" id="spinsterhood"> <label for="spinsterhood"> 未婚 </label> <input type="radio" name="marital_status" id="married"> <label for="married"> 已婚 </label> <input type="radio" name="marital_status" id="divorce"> <label for="divorce"> 离婚 </label> <input type="radio" name="marital_status" id="secret"> <label for="secret">保密</label> </td> </tr> <tr> <td><b>学历</b></td> <td><input type="text" name="edu_bg"></td> </tr> <tr> <td><b>喜欢的类型</b></td> <td> <input type="checkbox" name="like_type" id="wumei"> <label for="wumei"> 妩媚的 </label> <input type="checkbox" name="like_type" id="keai"> <label for="keai"> 可爱的 </label> <input type="checkbox" name="like_type" id="xiaoxianrou"> <label for="xiaoxianrou"> 小鲜肉 </label> <input type="checkbox" name="like_type" id="laolarou"> <label for="laolarou"> 老腊肉 </label> <input type="checkbox" name="like_type" id="douxihuan"> <label for="douxihuan"> 都喜欢 </label> </td> </tr> <tr> <td><b>自我介绍</b></td> <td> <textarea cols="30" rows="10" name="self_introduction"></textarea> </td> </tr> <tr> <td> <input type="submit" value=" 免费注册 "> </td> </tr> </table> </form>```帮我修改一下
04-01
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值