HTML常用标签

107 阅读1分钟

1.a标签的用法

<a herf="//goodle.com"> </a>

  • 跳转进入网址
  • 目录路径下链接
  • 伪协议 (无动作查看、邮件、电话)
  • 查看id (跳转到指定标签)
  • 通过target决定打开窗口

2.img 标签的用法

<img src="xxx.png" alt="文本描述">

  • 作用是发出get请求,展示一张图片
  • 图片显示错误可用 alt 提示
  • 图片加载成功与否用 onload/onerror 显示,onerror加补救图片
  • 用 max-width:100% 手机端响应式显示

3.table 标签的用法

<table>
        <thead>
            <tr>
                <th></th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td></td>
            </tr>
        </tbody>
        <tfoot></tfoot>
</table>
  • thead、tbody、tfoot 三个标签位置互换仍按顺序显示
  • table-layout auto按内容分大小;fixed 尽量保证平均分配
  • border-collapse:边框合并
  • border-spacing:边框间隙调整