html+css作业2-优秀学生表格&会员注册表单


0 前言

记录前端学习~

1 优秀学生表格

目标样式

优秀学生信息表格样式

代码

文件结构

文件结构

test.html

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <table border="2" width="400" height="400">
    <caption>
      <h3>优秀学生信息表格</h3>
    </caption>
    <thead>
      <tr>
        <th>年级</th>
        <th>姓名</th>
        <th>学号</th>
        <th>班级</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td rowspan="2">高三</td>
        <td>张三</td>
        <td>110</td>
        <td>三年二班</td>
      </tr>
      <tr>
        <td>赵四</td>
        <td>120</td>
        <td>三年三班</td>
      </tr>
    </tbody>
    <tfoot>
      <tr>
        <td>评语</td>
        <td colspan="3">优秀</td>
      </tr>
    </tfoot>   
  </table>
</body>
</html>

2 会员注册表单

目标样式

会员注册表单样式

代码

文件结构

文件结构

test.html

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <h1>青春不常在,抓紧谈恋爱</h1>
  <hr>
  <form action="">
    <label>昵称:
      <input type="text" placeholder="请输入昵称">
    </label>
    <br><br>
    <label>性别:
      <label>
        <input type="radio" name="gender" checked></label>
      <label>
        <input type="radio" name="gender"></label>
    </label>
    <br><br>
    <label>所在城市:
      <select>
        <option>上海</option>
        <option>北京</option>
        <option>广州</option>
        <option>深圳</option>
      </select>
    </label>
    <br><br>
    <label>婚姻状况:
      <label>
        <input type="radio" name="marriage" checked>未婚
      </label>
      <label>
        <input type="radio" name="marriage">已婚
      </label>
      <label>
        <input type="radio" name="marriage">保密
      </label>
    </label>
    <br><br>
    <label>喜欢的类型:
      <label>
        <input type="checkbox" checked>可爱
      </label>
      <label >
        <input type="checkbox" checked>性感
      </label>
      <label>
        <input type="checkbox">御姐
      </label>
      <label>
        <input type="checkbox">小鲜肉
      </label>
      <label>
        <input type="checkbox">大叔
      </label>
    </label>
    <br><br>
    <label>个人介绍:
      <br><br>
      <textarea cols="60" rows="10"></textarea>
    </label>
    <h3>我承诺</h3>
    <ul>
      <li>年满18岁、单身</li>
      <li>抱着严肃的态度</li>
      <li>真诚寻找另一半</li>
    </ul>
    <input type="checkbox">我同意所有条款
    <br><br>
    <button type="submit">免费注册</button>
    <button type="reset">重置</button>
  </form>
</body>
</html>

总结

  • table 标签:定义一个表格
  • caption 标签:定义表格标题,嵌套在table中,且只能对每个表格定义一个标题,通常这个标题会被居中于表格之上
  • tr 标签:定义表格中的一行,嵌套在table中
  • th 标签:定义表格中的表头单元格,嵌套在tr中
  • td 标签:定义表格中的数据单元格,嵌套在tr中
  • br 可插入一个简单的换行符
  • form 标签是表单标签,action 属性设置提交的服务器地址,method 属性设置提交的方式 GET (默认值)或 POST
  • input嵌套在label里面时:点击“昵称:” ,焦点会调到input文本框内
  • radio 单选框通过添加相同的name,使得同一name下的单选框只能同时选中一个
  • checked 属性在单选框和复选框时,表示默认选中
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值