HTML 标签分类

按类型

  block:块

    div、p、ul、li、h1……

    独占一行

    支持所有样式

    不写宽的时候,与父元素的宽相同

    所占区域是一个矩形

  inline:内联

    span、 a、em、strong、img……(img可以设置宽高,因为他还是一个替换元素)

    挨在一起的

    有些样式不支持,例如width、height、margin、padding

    不写宽的时候宽由内容决定

    所占的区域不一定是矩形

    内联标签之间会有空隙(原因:换行产生)代码放在一行没有空隙

    在最大的父容器把字体设置为0,然后给标签加上字体大小

  inline-block:内联块

    input、select……

    两个都有

  
      布局一般用块标签,修饰文本一般用内联标签


按内容

  Flow:流内容

    a abbr address area* article aside audio b

    bdi bdo blockquote br button canvas cite code

    data date datalist del details dfn dialog div dl em

    embed fieldset figure footer form h1 h2 h3 h4 h5 h6

    header hgroup hr i iframe img input ins kbd keygen

    label link* main* map mark math menu meta* meter

    nav noscript object ol output p picture pre progress q

    ruby s samp script section select slot small span strong

    sub sup svg table template textarea time u ul var video

    wbr (autonomous custom elements Text*)

  Metadata:元数据

    base link meta noscript script style template title

  Sectioning:分区

    article aside nav section

  Heading:标题

    h1 h2 h3 h4 h5 h6 hgroup

  Phrasing:措辞

    a* abbr area* audio b bdi bdo br button canvas cite code

    data date datalist del* dfn em embed i iframe img input

    ins* kbd keygen label link* map* mark math meta* meter

    noscript object output picture progress q ruby s samp script

    select slot small span strong sub sup svg template textarea

    time u var video wbr autonomous custom elements Text*

  Embedded:嵌入的

    audio canvas embed iframe img math object picture svg video

  Interactive:互动的    

    a* audio* button details embed iframe img* input* keygen

    label object* select textarea video*

按显示

  替换元素:浏览器根据元素的标签和属性,来决定元素的据体显示内容

    img src、input type……(标签需要属性来操作)

  非替换元素:将内容直接告诉浏览器,将其显示出来

    div、h1、p……(直接标签就可以)

上一篇:css中大于符号是什么意思


下一篇:CSS - CSS 选择器