a 标签的用法

<a href="//google.com">超链接</a>

属性

  1. href
  • 取值有网址、路径、伪协议
  • 作用 跳到外部连接、内部锚点、邮箱电话
  1. target
  •   target="_nblank" 在空白页打开
    
  •  target="_top" 在顶级窗口打开
    
  •  target="_parent" 在当前界面iframe的上一层打开
    
  •  target="_self" 在自己页面
    

img 标签的用法

    <img src="dog.jpg" alt="狗">

发出get请求,展示图片

属性

  1. alt:aternative 替换 当图片无法加载时,用于补救。
  2. width/height:图片宽高
  3. src:source 图片地址来源

table 标签的用法

分为三部分:<thead><tbody><tfoot>

    <table>
        <thead>
            <tr>
                <th>表头</th>
                <th>表头</th>
                <th>表头</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>内容</td>
                <td>内容</td>
                <td>内容</td>
            </tr>
        </tbody>
        <tfoot>
            <tr>
                <td>内容</td>
                <td>内容</td>
                <td>内容</td>
            </tr>
        </tfoot>
    </table>
  • tr标签:table row 表行
  • th标签:table head 表头标题
  • td标签:table data 内容

样式

  • table-layout : auto; 自动调节
  • border-collapse: collapse; 合并边框
  • border-spacing:0; 边框之间的距离

form 表单标签

发get或post请求,然后刷新页面

    <form action="/xxx" method="POST">
        <input type="text">
        <input type="submit">
    </form>

属性

  • action: 控制请求那个页面
  • method: 控制请求方式
  • autocomplete:自动填充
  • target: 同href
input和button
  • input 让用户输入,不能加其他
  • button 可以加其他(图片)

input属性type

  • button
  • checkbox 多选
  • password
  • radio 单选
  • submit 提交
  • text
  • file 文件
  • hidden

其他输入标签textarea、select+option

    <select name="location" id="1">
                <option value="sh">上海</option>
                <option value="bj">北京</option>
                <option value="cd">成都</option>
    </select>

注意

  • form 里面的input要有name
  • form 要有type=submit才能触发submit事件