Many tags can be used to change the appearance of text and to associate the text with its hidden meanings. In general, these tags can be divided into two categories: the Content-based style (content-based style) and the physical style (physical style).
Content-based styles
A content-based style label tells the browser that the text it contains has a specific meaning, context, or usage. The browser then applies the formatting that is consistent with that meaning, context, or usage to the text. Please pay attention to the difference in this area. Content-based tagging gives meaning, not formatting. Therefore, they are very important for automatic processing, and computers do not care what the document looks like.
Because font styles are specified by semantic cues, the browser can choose a suitable display style for the user. Because of the variety of styles in different locations, using content-based styles can help you ensure that your documents are meaningful to a wide range of readers. This is especially important for browsers that are dedicated to the blind and disabled, because their display options may be fundamentally different from our traditional text, or have a very large limitation in some way.
The current HTML and XHTML standards do not define a format for each content-based label, and they only stipulate that content-based styles must be displayed in a different way from the normal text in the document. Standards do not even require that these content-based styles be displayed in a different way from one another. In practice, you may find that many of these labels have a very clear relationship with traditional printing, they have similar meanings and display styles, and are displayed in most browsers in the same style and font.
There are rules to follow when using html/xhtml-based style labels, because it's easy to simply think about how the text should be displayed without having to know what the text means. Once you get started with content-based styling, your documents will be more consistent and better able to help with automated search and content editing. These tags are:
- <abbr>
- <acronym>
- <cite>
- <code>
- <dfn>
- <em>
- <kbd>
- <samp>
- <strong>
- <var>
Physical Style
We often use the word "intent" when discussing content-based style labels. This is because the meaning conveyed by the label is more important than the way the browser displays the text. However, in some cases, it may be due to legitimate or copyright reasons, and you want the text to appear in a special way (such as italic or bold). In this case, you can use a physical style for the text.
While the trend in other word processing systems is to precisely control the style and appearance, when using HTML or XHTML, you should avoid using physical tags unless there are very few cases. You should provide contextual information to the browser whenever possible, and use a content-based style. Although browsers now display these text in italics or in bold, future browsers and various document generation tools may take advantage of these content-based styles in a very well-created way.
The current html/xhtml Standard offers 9 physical styles, including bold (bold), Italic (italic), equal width (monospaced), underscore (underlined), strikethrough (strikethrough), magnification (larger), Narrow (smaller), superscript (superscripted), and subscript (subscripted) text. These tags are:
- <b>
- <big>
- <i>
- <s>
- <small>
- <strike>
- <sub>
- <sup>
- <tt>
Tip: Keep in mind that these physical style labels have a strong effect on the text immediately following it. To achieve full control over the text display throughout the document, use the style sheet.
HTML Tutorial Extended reading: Changing the appearance and meaning of text