Use CSS to define the first line of each paragraph indent 2 characters to go

Source: Internet
Author: User

tags and web pages should be used in accordance with the html/xhtml standards established by the website. If you are not familiar with this, you can go to the Web site www.w3.org to find relevant information, or buy an XHTML book (Pay attention not to buy outdated HTML books, try to choose foreigners to write) to see.

In your question, the first thing you need to know is the difference between the block element and the inline element, and the P, Div, and so on are the block elements, and a, span, and BR are all inline elements. Text-indent since it defines the information associated with a paragraph, that is, the indentation of the paragraph, it only works on the block element rather than on the inline element.

So, if you write:

p {TEXT-INDENT:2EM}

<p>first para...</p>
<p>second Long Paragraph ......................................................................................................................... .......................................</p>
will be able to achieve results.

However, if it is
<p>
First line<br/>
Second line<br/>
</p>

You don't expect it, because Text-indent is the style of P, not the BR style. Can you set the text-indent style for BR?

Obviously, because BR is simply an empty element, it means that the text-indent is not used, and there is no content in BR, what is the style of the content?

The reason for this confusion is that you do not have the thought of entering the markup language from the traditional plain text with the/n line break to denote the end of the paragraph and the beginning of the habit, so you do not understand that the text paragraph should be expressed in P. BR is simply a format tag that provides the force of a newline when necessary, such as a newline to represent program code.

Use CSS to define the first line of each paragraph indent 2 characters to go

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.