如何调整<td>... </td>内容的行间距

本文介绍了如何设置HTML表格的CELLPADDING(内文字与边框间距)和CELLSPACING(表格单元格间距),帮助读者掌握表格布局的基本技能。
<table CELLPADDING="5" CELLSPACING="5">

设置CELLPADDING (内文字与边框间距)
设置CELLSPACING (表格单元格间距)

<!DOCTYPE html> <html lang="zh"> <head> <meta charset="UTF-8"> <title>新用户注册</title> </head> <body> <form method="POST" action=""> <table> <tr> <td>姓名:</td> <td><input type="text" name="name" required></td> </tr> <tr> <td>密码:</td> <td><input type="password" name="password" required></td> <td>确认密码:</td> <td><input type="password" name="confirm_password" required></td> </tr> <tr> <td>性别:</td> <td> <input type="radio" name="gender" value="男" checked> 男 <input type="radio" name="gender" value="女"> 女 </td> </tr> <tr> <td>爱好:</td> <td> <input type="checkbox" name="hobbies[]" value="唱"> 唱 <input type="checkbox" name="hobbies[]" value="跳"> 跳 <input type="checkbox" name="hobbies[]" value="RAP"> RAP </td> </tr> <tr> <td>学院:</td> <td> <select name="college"> <option value="">请选择</option> <option value="信管学院">信管学院</option> <option value="工商学院">工商学院</option> <option value="文法学院">文法学院</option> </select> </td> <td>班级:</td> <td><input type="text" name="class"></td> </tr> <tr> <td colspan="4"> <input type="submit" value="提交"> <input type="reset" value="重置"> </td> </tr> </table> </form> <?php if ($_SERVER['REQUEST_METHOD'] == 'POST') { $name = htmlspecialchars($_POST['name']); $password = $_POST['password']; $confirm_password = $_POST['confirm_password']; $gender = $_POST['gender']; $college = $_POST['college']; $class = htmlspecialchars($_POST['class']); $hobbies = isset($_POST['hobbies']) ? $_POST['hobbies'] : []; if ($password !== $confirm_password) { echo "<p style='color:red;'>两次输入的密码不一致!</p>"; exit; } echo "<h3>注册成功,您的信息如下:</h3>"; echo "<p><strong>姓名:</strong> $name </p>"; echo "<p><strong>性别:</strong> $gender </p>"; echo "<p><strong>密码:</strong> " . str_repeat("*", strlen($password)) . " </p>"; echo "<p><strong>学院:</strong> $college </p>"; echo "<p><strong>班级:</strong> $class </p>"; echo "<p><strong>爱好:</strong> " . implode(",", $hobbies) . " </p>"; } ?> </body> </html> 加上表格
最新发布
09-30
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值