《HTML常用标签》

98 阅读1分钟

1.a标签用法

- 一般为<a href="" target=""> </a>

  • 其属性包括:href/target/rel=noopener
  • 其作用包括:跳转外部页面、跳转内部锚点、跳转到邮箱及电话等。
- href的取值包括
  • 网址:https:// http //xxxx.com
  • 路径:/a/b/c a/b/c index.html ./index.html
  • 伪协议:javascript:代码; mailto:邮箱 tel:手机号
  • id:href=#xxx
target的取值包括
  • 内置名字:_blank _top _parent /_self
  • 程序员命名:window的name、iframe的name

2.img标签的用法

- 一般为<img src="" alt="" />

  • 其属性有:alt/height/width/src (alt属性是加载图片失败时显示的文字)
  • 其作用:发出get请求,展示一张图
  • 如果要让图片根据画面的缩放而缩放,但是不改变图片比例,一般用响应式max-width:100%

3.table标签的用法

<body>
    <table>
        <thead>
            <tr>
                <th></th>
                <th></th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td></td>
                <td></td>
            </tr>
        </tbody>
        <tfoot>
            <tr>
                <td></td>
                <td></td>
            </tr>
        </tfoot>
    </table>
</body>
  • table的相关标签中,thead、tbody、tfoot的位置顺序跟最终效果是没有联系的,就算tfoot放在第一位,它也是在表格最后一行显示。