Learn more about the line height property of CSS

Source: Internet
Author: User

What is Line spacing?

In ancient times we used printing presses to come out with WORDS. Each of the printed words is in a separate block.

Line spacing, which is legendary to control the vertical distance between two lines of Text. In css, line-height is used to control the vertical distance between rows and Rows.

however, the line spacing and half-line spacing are still dependent on the line-height in the Css. so, How to use line-height?

Default state, The browser uses 1.0-1.2 line-height, which is an initial Value. You can define the Line-height property to overwrite the initial value: p{line-height:140%}

There are 5 ways you can define Line-height.

1.line-height can be defined as: body{line-height:normal;}

2.line-height can be defined as: body{line-height:inherit;}

3.line-height can use a percentage of the value body{line-height:120%;}

4.line-height can be defined as a length value (px,em, etc.) body{line-height:25px;}

5.line-height can also be defined as a pure number, body{line-height:1.2}

Abbreviation Line-height

The 5 types of line-height can be abbreviated in the font Attribute. The value of the line-height is followed by a font-size value separated by a slash, such as:<font-size>/<line-height>

Example: body{font:100%/normal arial;}, body{font:100%/120% arial;}, body{font:100%/1.2 arial;} , body{font:100%/25px arial;}

Calculate Line-height

Some CSS properties are inheritable (inherited), which are passed down from the stacked Elements. This is done to make it easier for developers to no longer reset values for descendant Elements.

For Line-height inheritance is a bit complicated.

1. percentage

2. length

3 Value: Normal

4 Pure Numerals

(but the actual combat application in the Chinese font or the English font mix, as well as Ie678,xp win7, row high rules and different, tears)

Learn more about the line height property of CSS

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.