怎么控制某些控件自动换行? 如<input>、<radio>等。

本文介绍了一种使用表格进行网页元素定位的方法,并通过隐藏边框来达到布局的目的。

如题。

将他们限定在某个<td>中。用表格控制住他们,让他们就在某个位置显示。

然后将边框设置为不显示,即可。


HTML常用标签整理 <!-- h1-h6 -->     <h1>标题</h1>     <p>段落</p>     <!-- 列表 -->     <ul>         <li>列表项</li>         <li>列表项</li>         <li>列表项</li>     </ul>     <!-- 文本标签 -->     <strong>加粗</strong>     斜体字     <ins>下划线</ins>     <del>删除线</del>     <!-- 超链接 -->     <a href="#" target="_blank">超链接</a>     <!-- 图片 -->     <img src="第4章/hong.png" alt="">     <!-- 表格 -->     <table border="1">         <tr>             <td colspan="2">学号/姓名</td>             <td rowspan="2">性别/男</td>         </tr>         <tr>             <td>20230101</td>             <td>林志远</td>         </tr>     </table>     <!-- 水平线(单标签) -->     <hr>     <!-- 换行 -->     <br>     <!-- 表单 -->     <form action="#" method="post">         文本框:<input type="text"> <br>         密码框:<input type="password"> <br>         单选框:<input type="radio" name="sex">男 <br>         复选框:<input type="checkbox" name="hobby">爱好 <br>         文件上传:<input type="file"> <br>         日期选择:<input type="date"> <br>         颜色选择:<input type="color"> <br>         邮箱:<input type="email"> <br>         数字:<input type="number"> <br>         下拉菜单:         <select name="city">             <option value="">泉州市</option>             <option value="">厦门市</option>         </select>         <br>         <input type="submit" value="提交">         <input type="reset" value="重置">         <input type="button" value="普通按钮">     </form>     <!-- 结构标签(语义化标签) -->     <header>头部</header>     <nav>导航栏</nav>     <section>区块</section>     <article>文章</article>     <aside>侧边栏</aside>     <footer>底部</footer>     <!-- 盒子标签(块元素) -->     <div>盒子模型</div>     <!-- span (行内元素) -->     <span>span</span>
05-31
<!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="UTF-8"> <title>大学生暑期社会实践报名表</title> </head> <body> <!-- 页面主标题 --> <h1 align="center">大学生暑期社会实践报名表</h1> <hr> <!-- 表单开始区域 --> <form action="#" method="POST"> <!-- 1. 文本输入框 --> <label for="stuName">学生姓名:</label> <input type="text" id="stuName" name="username" placeholder="请输入真实姓名"> <br><br> <!-- 2. 密码框(演示用,如查询密码) --> <label for="pwd">查询密码:</label> <input type="password" id="pwd" name="password" placeholder="设置6位查询密码"> <br><br> <!-- 3. 单选按钮 (注意 name 必须相同才能互斥) --> <label>您的性别:</label> <input type="radio" id="male" name="gender" value="男" checked> <label for="male">男</label> <input type="radio" id="female" name="gender" value="女"> <label for="female">女</label> <br><br> <!-- 4. 下拉菜单 --> <label for="campus">所在校区:</label> <select id="campus" name="campus"> <option value="">--请选择--</option> <option value="north">北校区</option> <option value="south">南校区</option> <option value="east">东校区</option> </select> <br><br> <!-- 5. 复选框 (可多选) --> <label>意向岗位(多选):</label> <br> <input type="checkbox" id="teach" name="job" value="支教"> <label for="teach">乡村支教</label> <br> <input type="checkbox" id="research" name="job" value="调研"> <label for="research">社会调研</label> <br> <input type="checkbox" id="tech" name="job" value="技术"> <label for="tech">技术支持</label> <br><br> <!-- 6. 日期选择器 --> <label for="birthday">出生日期:</label> <input type="date" id="birthday" name="birthday"> <br><br> <!-- 7. 文件上传 --> <label for="resume">上传简历:</label> <input type="file" id="resume" name="file"> <br><br> <!-- 8. 多行文本域 --> <label for="intro">个人优势/备注:</label><br> <textarea id="intro" name="intro" rows="5" cols="40" placeholder="请简述你的特长..."></textarea> <br><br> <!-- 9. 按钮区域 --> <input type="submit" value="立即报名">    <input type="reset" value="重新填写"> </form> <br> <hr> <p align="center"><small>版权所有 © 2025 学生工作处</small></p > </body> </html>以上哪里有问题帮我修改并输出正确的
最新发布
12-09
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>商品管理</title> <script src="./js/echarts.js"></script> <link rel="stylesheet" href="./css/public.css" /> <link rel="stylesheet" href="./css/goodschild.css" /> <link rel="stylesheet" href="./css/myPagination.css"> <script src="./js/jquery-3.7.1.min.js"></script> <script type="text/javascript" charset="utf-8" src="./ueditor/ueditor.config.js"></script> <script type="text/javascript" charset="utf-8" src="./ueditor/ueditor.all.min.js"> </script> <script type="text/javascript" charset="utf-8" src="./ueditor/lang/zh-cn/zh-cn.js"></script> </head> <body> <!-- 预览的幕布 --> <div id="imagePreview" class="preview_modal" onclick="previewCancel()"> <!-- 预览的图片 --> <img id="previewImage" src="" alt="Preview Image"> </div> <!-- 顶部下拉框 --> <div class="top_box" id="top_box"> <div class="top_left"> <input type="text" placeholder="请输入产品名称搜索" id="searchInput"> </div> <div class="top_right"> <button id="searchBtn">搜索</button> <button id="resetBtn">重置</button> </div> </div> <!-- 按钮区域 --> <div class="top_boxs"> <div class="top_button"> <button id="addition" class="icon-btns"> <img src="./img/返回.png" alt="图标描述" width="15" height="15"> <p>返回</p> </button> <button id="additionst" class="icon-btns"> <img src="./img/加号.png" alt="图标描述" width="20" height="20"> <p>新增</p> </button> <button id="expurgate" class="icon-btn" disabled> <p>全部</p> <span class="badge" id="badge_first"></span> </button> <button id="search" class="icon-btn" disabled> <p>待审核</p> <span class="badge" id="badge_second"></span> </button> <button id="searchsa" class="icon-btn" disabled> <p>回收站</p> <span class="badge" id="badge_seconds"></span> </button> <button id="additions" class="icon-btns"> <p>批量审核</p> </button> <button id="expurgates" class="icon-btn"> <img src="./img/删除.png" alt="图标描述" width="20" height="20"> <p>批量删除</p> </button> </div> <div class="screen" id="refreshs"> <div class="screen_box"> <img src="./img/搜索-灰色.png" alt="刷新" class="renovate" id="searchs" /> </div> <div class="screen_box"> <img src="./img/刷新.png" alt="刷新" class="renovate" id="refresh" /> </div> <div class="screen_box"> <div class="screen_img"> <img src="./img/设置-灰色.png" alt="刷新" class="renovate" id="install" /> </div> <div class="setting_box"> <p class="setting_title">显示设置</p> <div class="setting_items"> <label> <input type="checkbox" value="id" checked> ID </label> <label> <input type="checkbox" value="company" checked> 公司名称 </label> <label> <input type="checkbox" value="tradeid" checked> 产品名称 </label> <label> <input type="checkbox" value="img" checked> 商品图片 </label> <label> <input type="checkbox" value="name" checked>行业 </label> <label> <input type="checkbox" value="status" checked> 审核状态 </label> <label> <input type="checkbox" value="type" checked> 上架状态 </label> <label> <input type="checkbox" value="create_time" checked> 创建时间 </label> </div> </div> </div> </div> </div> <div class="base_box"> <div id="base_package"> <table class="table_table-bordered"> <thead> <tr> <th> <input type="checkbox" id="selectAll" name="check-all"> </th> <th>id</th> <th>公司名称</th> <th>产品名称</th> <th>商品图片</th> <th>行业</th> <th>审核状态</th> <th>上架状态</th> <th>创建时间</th> <th>操作</th> </tr> </thead> <tbody> </tbody> </table> </div> <!-- 底部分页 --> <div class="pagination_box"> <div id="pagination" class="pagination"></div> </div> </div> <!-- 新增弹窗 --> <div class="windows_box"> <div class="paddle_box"> <p class="title">添加/编辑</p> <div class="form-item"> <p>*产品名称</p> <input type="text" name="productName" id="productName" placeholder="请输入内容名称"> </div> <div class="form-item"> <p>*产品图片</p> <div class="img_pop"> <form id="myForm"> <label> <input type="file" name="file" id="file" style="display: none;" onchange="upload(true)" accept="image/*"> <img src="./img/10050.png" id="pic"> </label> </form> <p class="error" id="img_error">图片</p> </div> </div> <div class="form-item"> <p>*产品介绍</p> <div class="described"> <div class="texta" id="editor"></div> <p class="error" id="text_error">详情</p> </div> </div> <div id="parcel" class="parcel"> <div class="radio-group"> <p>*上下架</p> <input type="radio" name="shelf" value="on" checked> <span>上架</span> <input type="radio" name="shelf" value="off"> <span>不需要</span> </div> <!-- 操作按钮 --> <div class="hint_button"> <button class="hint_right" onclick="zxc()">确认</button> <button class="hint_left" onclick="asd()">确定并继续添加</button> </div> </div> </div> </div> <!-- 删除弹窗 --> <div class="delete-mask" id="deleteMask"> <div class="delete-dialog" id="deleteDialog"> <div class="dialog-content" id="dialogContent"> <h3>确定要删除选中的行业吗?</h3> </div> <div class="dialog-actions" id="dialogActions"> <button class="action-cancel" id="cancelBtn" onclick="cancelDelete()">取消</button> <button class="action-confirm" id="confirmBtn" onclick="confirmDelete()">确定</button> </div> </div> </div> <!-- 失败 --> <div id="error"> <div class="errorCenter"> <img id="errorImg" src="./img/error.png" alt="" /> <span class="errorText"></span> </div> </div> <!-- 成功 --> <div id="success"> <div class="successCenter"> <img id="successImg" src="./img/yes.png" alt="" /> <span class="successText"></span> </div> </div> <script src="./js/public.js"></script> <script src="./js/goodschild.js"></script> <!-- 分页插件 --> <script src="./js/myPagination.js"></script> <!-- 富文本编辑器容器 --> <div class="texta" id="editor"></div> <script> // 初始化 UEditor 富文本编辑器 var ue = UE.getEditor('editor', { initialContent: '<span style="color: #999">请输入内容...</span>', // 初始占位符文本 autoHeight: false, }); // 监听编辑器准备就绪事件,为聚焦、失焦绑定占位符处理逻辑 ue.ready(() => { // 聚焦时,若内容是初始占位符则清空 ue.addListener('focus', () => { if (ue.getContent() === '<p><span style="color: #999">请输入内容...</span></p>') { ue.setContent(''); } }); // 失焦时,若内容为空或仅含换行则恢复占位符 ue.addListener('blur', () => { if (ue.getContent() === '' || ue.getContent() === '<p><br></p>') { ue.setContent('<span style="color: #999">请输入内容...</span>'); } }); }); </script> </body>
08-13
本关任务:完成一个表单的创建任务。 这里标签要按照规定格式来写,因为有 <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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值