Two words in front of the distance, do not use space, using CSS to achieve the first indent paragraph two characters. You should use the first line indent text-indent. text-indent can indent a unit in the first line of the container. For example, Chinese paragraphs usually have two characters in front of each paragraph.
Here we need to understand a length unit em. EM is the relative length unit. The font size relative to the text within the current object. We usually have two Chinese characters before each paragraph. In fact, the first line is indented 2em.
<style type= "Text/css" >
<!--
p{
Text-indent:2em; /*em is a relative unit, 2EM is now twice times the size of a word */
}
-
</style>
<p> the distance in front of the paragraph two words, do not use the space again. You should use the first line indent text-indent. Length Unit em. The font size relative to the text within the current object. We indented 2em in the first line. 2EM is now twice times the size of a word. </p>
--------------------------------------------------------------------------------------------------------------- --
Using CSS to achieve the first indentation of the paragraph two characters, the first line of indentation to achieve the general method is to add four small corner space.
In fact, it's more efficient to define CSS styles.
For example, define the following indentation style in style:. suojin{Text-indent:2em}
Use class= "Suojin" where you need to indent, such as defining an entire block of paragraphs with a div to indent first,
Where in the Div area, when the browser meets the P statement (that is, the beginning of a new paragraph), it executes the. Suojin defined indentation.
You can also use an inline CSS style to define it in the body, for example (change angle brackets to small angle brackets when using):
Paragraph one
Paragraph two
Paragraph three
Both methods have strengths and weaknesses that can be used to determine which method to use.
Note: The div tag does not forget the start character. Text-indent is only valid for P or div tags and does not take effect on BR tags because the br tag is a newline label and not a segmented label.
Div+css to indent two characters in the first line of a paragraph