Home  >  Article  >  Web Front-end  >  Alibaba interview questions - About the difference between physical tags and logical tags in html tags_html/css_WEB-ITnose

Alibaba interview questions - About the difference between physical tags and logical tags in html tags_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:39:581437browse

Regarding the difference between physical tags and logical tags in html tags, because the two achieve the same effect, people don’t pay much attention to the difference between the two. So today I will tell you that there is a difference.
The difference between them is that one is a physical mark (entity mark) and the other is a logical mark.
What are physical markers? What is a logical tag?
Physical elements emphasize a physical behavior. For example, if I bold a piece of text with a b mark, I mean to tell the browser that it should bold and display the text. From the semantics of the word, It can be analyzed that b is the abbreviation of Bold (bold), so the meaning conveyed by this B mark is only bold, without any other effect.
And we can know from the literal understanding of Strong that it means emphasis, so we use this tag to convey a message to the browser to emphasize a certain paragraph of text, and this Strong is what we call a logical element, it is an emphasis The logic of the document is not to tell the browser how it should be displayed.
Similarly, I is Italic (italic), and em is emphasis (emphasis).
So: the physical elements tell the browser in what format I should display the text, and the logical elements tell the browser how important these texts are.
is used on web pages. By default, they all function as bold fonts. The difference between the two is that the tag is an entity tag, and the characters it surrounds will be set to bold ( Bold), and the tag is a logical tag, its function is to strengthen the mood of the character. Generally speaking, strengthening the mood of the character is achieved by changing the character to bold (bold).
Simply put, strong is the tag of xhtml in web standards, strong means "emphasis"; b is of html, and b means bold (bold). Web standards advocate that xhtml does not involve specific forms of expression. "Emphasis" can be emphasized by bolding or other methods, such as underlining, enlarging the font, such as red, etc. Strong can be changed through CSS specific performance.
It’s not that the introduction of strong eliminates b. b is because it means bolding the font, which happens to be the same as the emphasis effect of strong by default. In fact, this strong can be defined as the emphasis effect of other styles. .
But in order to comply with the current W3C standards, it is recommended to use the strong tag.
strong tag: visual effect is bold. HTML semantics are emphasis, indicating emphasis and emphasis in tone.
When a blind person uses a screen reader, the difference between B and Strong can be clearly seen. When encountering B, read it in the same way as ordinary words. When encountering Strong, it will be emphasized and paused.
b tag: visual effect bold. It does not have HTML semantics per se.
WEB standards advocate the separation of style and content, so it is no longer recommended to use B purely to achieve boldness.

From the perspective of XHTML document meaningfulness and user experience, strong is more beneficial and is recommended to be used. As for SEO, it depends on the optimization situation.




So I personally think that everyone should use logical tags such as strong instead of physical tags. .

Copyright Statement: This article is an original article by the blogger and may not be reproduced without the blogger's permission.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn