Talk about your understanding of HTML semantic.

1. What is HTML semantics?

Basically revolves around several major labels, like the title (h1-h6), list (li), stressed (strong em) and so on.

Good resolution based on the semantic content of (structured content), select the appropriate label (Code semantics), for developers to read and write more elegant code at the same time, let the browser reptiles and machines.

2. Why semantics?

  • For in the absence of css, the page also able to show a good content structure and code structure.
  • In order to enhance the user experience, such as: title, alt term used to explain or interpret images utilizing information, lable label.
  • Search engines favor and establish good communication.
  • Other convenient analytical device (such as screen readers, the blind readers, mobile devices), with meaningful ways to render the page.
  • To facilitate the development and maintenance team, more readable semantic, it is an important trend of the next page, follow the W3C standard team follow this standard, can reduce the difference.

3. write HTML code should pay attention to what?

  • Minimal use of non-semantic tags span and div
  • When the semantic obvious when, div or may be used, as far as possible with the p, p has the vertical spacing as default, it is advantageous for special terminals compatible.
  • Do not use pure style tags, such as: b, font, u, etc., use css settings.
  • It should be emphasized text can be included in the strong (bold) or em (italics) tag (the browser default style, use css styles do not have them)
  • Use a table entitled to use the caption, header by thead, surrounded by the main part of tbody, surrounded by the tail to tfoot. Usually the cell header and to distinguish, with a header th, td cell with
  • Form fields use fieldset label wrap, and illustrate the use of the label with the legend label.
  • Each tag corresponds to input text box label require the use of labels, and by setting the id attribute input, provided the label should be described for = someID and text corresponding to the associated input.

 

Guess you like

Origin www.cnblogs.com/luoluo-snow/p/11505403.html