前端3+1(Day11)11.1(Front end 3 + 1 (Day11) 11.1)

前端3+1(Day11)

你对标签语义化的理解

就是标签对内容有所表达,例如HTML5语义化标签的主要有:

,,.,,,等等

优点:

  • 为了在没有css的情况下,页面也能呈现出很好的内容结构,代码结构
  • 比标签更具有丰富的含义,方便开发于维护
  • 方便搜索引擎能识别页面结构,有利于SEO
  • 方便其他设备解析(如盲人阅读器)
  • 有利于合作

注意点:

  • 应该尽可能少的使用无语义化的标签div,span
  • 在语义不明显示,既可以使用div或者p,尽量用p,因为p在默认情况下有上下间距,对兼容性特殊终端有利
  • 不要使用纯样式标签,如:b,font,u等,改用css
  • 需要强调的文本,可以包含在strong或者em标签中
  • 使用表格时,标题要用caption,表头要用thead,主体部分用tbody,尾部用tfoot
  • 表单域用fieldset标签包起来,用legend标签说明表单的用途
  • 每一个input都要有一个label对象
————————

Front end 3 + 1 (Day11)

Your understanding of label semantics

Tags express content. For example, HTML5 semantic tags mainly include:

,,.,,, wait

advantage:

  • In order to present a good content structure and code structure without CSS
  • It has richer meanings than labels and is convenient for development and maintenance
  • It is convenient for search engines to recognize the page structure, which is conducive to SEO
  • Facilitate parsing by other devices (e.g. blind readers)
  • Conducive to cooperation

Note:

  • The non semantic tag div, span should be used as little as possible
  • When the semantics is not clear, you can use div or P, and try to use p, because P has up-down spacing by default, which is beneficial to the terminal with special compatibility
  • Do not use pure style labels, such as B, font, u, etc. use CSS instead
  • The text that needs to be emphasized can be included in the strong or em tag
  • When using a table, the title should be caption, the header should be thead, the main part should be tbody, and the tail should be tFoot
  • The form fields are wrapped with a fieldset tag, and the purpose of the form is described with a legend tag
  • Each input must have a label object