HTML常用标签

HTML(HypeText Markup language)超文本标记语言

除了 div 和 span,其他标签都有默认样式

  • a标签
    download属性:表示是用来下载
    跳转页面发起的是GET(获取)请求
  • form
    跳转页面一般发起的是POST(上传)请求
    如果form表单里面没有【提交按钮】就无法提交这个form
    1
    2
    3
    4
    5
    <form action="user" method="POST">  
    <input type="text" name="username">
    <input type="password" name="password">
    <input type="submit" value="提交">
    </form>

type

  • button
    <button>button</button>如果没有type默认升级为subline
    <button type="button">button</button>没有提交作用
  • checkbox
    image.png
    设置label for与input的ID进行关联,此时点击文字就能勾选
    老司机是这样写的用labelinput包起来就可以达到和上面同样的效果
    image.png
  • radio 单选
    只能选择一个,前提是name要设定一致
  • -select 下拉列表
    image.png
    disable不可以选择,selected默认选择
    value是空 则没有值
    select中如果添加一个multiple则可以多选
    image.png
  • textarea 文本域
    一定要给一个name否则无法提交
    resize:none设置不可以被拉伸,用CSS设置宽高

    table 表格

  • th(table row)表示表头 td(table data)表示信息
    colgroup中col设置每一列宽高
    image.png
  • 的顺序不影响呈现出的内容
    CSS中加入border-collapse:collapse;可以使表格之间的空隙取消
    image.png
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
                <thead>
    <tr>
    <th>姓名</th><th>学校</th><th>年级</th><th>班级</th>
    </tr>
    </thead>
    <tbody>
    <tr>
    <th>小红</th><td>育红小学</td><td>三年级</td><td>七班</td>
    </tr>
    </tbody>
    <tfoot>
    <tr>
    <th>小明</th><td>育红小学</td><td>三年级</td><td>八班</td>
    </tr>
    </tfoot>
    </table>

image.png