CSS implementation paragraph first line indent two characters no longer use spaces

Source: Internet
Author: User
Tags empty

Want to let the paragraph front empty two words distance does not use a space, text-indent can make the first line in the container indent a certain unit. For example, Chinese paragraphs in general each paragraph before empty two Chinese characters, interested friends can refer to, I hope to help you

 

Empty two words before the paragraph, do not use the space again. You should use the first line indent text-indent. Text-indent can make the first line in the container indent a certain unit. For example, Chinese paragraphs usually empty two characters before each paragraph.

Copy Code code as follows:


<style type= "Text/css" >


p{


Text-indent:2em; /*em is the relative unit, 2EM is now twice times the size of a word * *


}


</style>


Note: Div tags do not forget the start character. Text-indent is valid only for P or div tags and does not take effect on the BR label because the BR label is a newline label and not a segmented label.

Using CSS to achieve the first indent paragraph two characters, the first line of indentation to achieve a common method is to add four small corner spaces.

Define the following indentation style in style:. Suojin{text-indent:2em}

Use class= "Suojin" where you want to indent, such as using a div to define an entire paragraph indented first,

Where in the Div area the browser meets the P statement (that is, the beginning of a new segment), it executes the indentation defined by the. Suojin.

You can also use an inline CSS style in the body to define the following example (change angle brackets to small angle brackets when used):

<div style= "Text-indent:2em" >
<p> paragraph One </p>
<p> paragraph two </p>
<p> paragraph three <p>
</div>

Both methods have strengths and weaknesses that can be determined by the need to decide which method to use.

        Note : more Wonderful tutorials please focus on the Triple Web Design tutorial columns,

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.