One, use full-width space
Full-width spaces are interpreted as Chinese characters, so they are not interpreted as HTML separators and can be displayed in the actual number of spaces.
Second, the use of space substitution symbol
Alternate symbols include alternate symbols where spaces are needed, which are interpreted by the browser as spaces.
There are several alternative symbols for spaces:
name |
numbering |
Description |
|
& #160; |
Continuous white space (1 character width) |
  |
& #8194; |
Half Blank (1 character width) |
  |
& #8195; |
A blank (2 character width) |
  |
& #8201; |
Narrow white space (less than 1 characters wide) |
You can use a name or number as a substitute for a space, the name must be lowercase, and the end ";" cannot be omitted.
such as: Huan ying light Pro!
The display effect is: Welcome!
Note that if there are English words in the text, the blanks are added between the letters, not between the words.
Third, using the CSS Text-indent property
The Text-indent property of the CSS is used to set the first line indent, which can be a length value with a unit, and the browser sets the specified length of space at the beginning of the first line of the paragraph. Like what:
<div style= "Text-indent:2em" > Welcome! </div>
Description: EM is a relative length unit, and 2EM represents the distance to indent two characters.
Four, the space in the HTML phenomenon
<style type= "Text/css" > { border: 1px solid red; font-family:"song body"; /* font-family:arial; */ /* font-family: "SimSun"; */ /* font-family: ' Microsoft yahei '; */ font-size: 20px; } </style>
<spanclass= "Blankone"> </span> <spanclass= "Blankone"> </span> <spanclass= "Blankone"style= "margin-left:10px;">Song</span>
Five. contenteditable= ' true ' div edit whitespace phenomenon
<styletype= "Text/css">. Blankone{Border:1px solid Red;font-family:"The song Body";font-size:20px; } </style> <!--contenteditable=true The white space width of the contents of the Cocoa Editor Firefox: All half Chinese characters width Google Chrome: The first space is the second space is half a Chinese character IE browser: Half a space - <Divclass= "Blankone"contenteditable= "true"></Div>
Space in HTML displays distance problem