CSS implements indent of first line of paragraph

Source: Internet
Author: User
Keywords Web page production CSS Tutorials
Tags can make example firefox html http text use web

Empty two words before the paragraph, do not use space. 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.

Here we need to know a length unit em. EM is the relative length unit. The font size relative to the text within the current object.

We usually empty two Chinese characters before each paragraph. In fact, the first line is indented 2em.

Look at the following example:

<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 strict//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" >
<html xmlns= "http://www.w3.org/1999/xhtml" >
<head>
<meta http-equiv= "Content-type" content= "HTML; Charset=utf-8 "/>
<title>php Information-www.phpq.net</title>
<style type= "Text/css" >
P{text-indent:2em/*em is the relative unit, 2EM is now twice times the size of a word */}
</style>
</head>
<body>
<p> paragraph before empty two words of distance, do not use space. You should use the first line indent text-indent. Length Unit em. The font size relative to the text within the current object. Our first line shrank to 2EM. 2EM is now twice times the size of a word. I learned a lot of new knowledge in the Web teaching network </p>
</body>
</html>

Incidentally, the problem with text-indent attribute hidden text

The link uses the picture to make the background, text-indent:-9999px; Hidden text, this effect in IE is normal, but in Firefox, when the mouse clicks on the link, the dotted box will wrap the indented text, the result is shown as dotted box N long.

Because usually use Overflow:hidden; property, so you never notice the existence of this problem, but when you need to use JS to implement some kind of interaction, it is strongly recommended not to use Overflow:hidden; attribute, because it will bring you a lot of unexpected trouble.

The dotted box, in fact, is the outline attribute in CSS, which also shows that IE and Firefox for outline and border resolution range is inconsistent: ie think that the dotted box is the edge of the border, and Firefox is that the dotted box should be text range

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.