Getting to combat web front end: HTML character entities with text formatting tags

HTML character entities / HTML in a reserved character must be replaced with character entities, some of the characters not found on the keyboard can also be used to replace the use of character entities.

In HTML, certain characters are reserved. You can not use text that contains these characters. You can not use less than (<) and greater than (>) in HTML, this is because the browser will mistakenly believe that they are tag. If you want to correctly display reserved characters, we must use the character entity (character entities) in the HTML source code. Character entity like this:

1  &entity_name; 
2 或 3 &#entity_number; 4 &lt; 或 &#60; 或 &#060;
专门建立的学习Q-q-u-n: 784783012 ,分享学习的方法和需要注意的小细节,不停更新最新的教程和学习技巧
(从零基础开始到前端项目实战教程,学习工具,全栈开发学习路线以及规划)
1 <!DOCTYPE html>
 2 <html>
 3 <head>
 4     <meta charset="UTF-8">
 5     <title>HTML 实体</title>
 6 </head>
 7 <body>
 8     <!-- stat_begin -->
 9      <p>&entity_name; 或&#entity_number; </p>
10      <p>&lt; 或 &#60; 或 &#060;</p>
11     <del>e.g:使用实体名而不是数字的好处是,名称易于记忆。不过坏处是,浏览器也许并不支持所有实体名称(对实体数字的支持却很好</del>
12     <!-- stat_end -->
13 </body>
14 </html>

Browser display of results:

Getting to combat web front end: HTML character entities with text formatting tags


Nonbreaking space (Non-breaking Space)? HTML character entities are commonly used in the non-breaking space (). The browser will always truncate spaces in HTML pages. If you write 10 spaces in the text, before displaying the page, the browser will delete them 9. To increase the number of spaces on the page, you need to use the character entity.

Combined with phonetic symbols? A pronunciation symbol is applied to the letter "Glyph (shape)"; number of diacritical marks, such as acute accent () and the grave (); diacritics may occur above and below the letters or letter inside, or between two letters; umlaut may be used a combination of letters, numbers and characters.

Getting to combat web front end: HTML character entities with text formatting tags

Legend: letter-spacing / word spacing /2.word-spacing/ word spacing / word-break: break-all ; / text wrap wrap, Chinese will wrap, word ok, not letters, the default text added overflow: Auto; Word-BREAK: BREAK-All; / BREAK-Word: Keep-All; / no wrap / white-space: nowrap; / not wrap /

Getting to combat web front end: HTML character entities with text formatting tags

Guess you like

Origin blog.51cto.com/14592820/2485815
Recommended