The difference between line-height:150% and line-height:1.5

Source: Internet
Author: User

Base is font-size, whether it's inherited or its own.

"%": the distance to inherit the parent element

"No units": calculates the respective distances.

See DEMO1:

Style

        body{            font-size:14px;            line-height:150%;        }        #p1 {            font-size:12px;        }

Structure:

<body> <p id= "P1" > I'm a good person </p></body>

And then through

Console.log ($ ("#p1"). CSS ("Line-height"));

Gets the line height of P to 21.

Demo2:

Style:

        . box{            font-size:12px;            line-height:1.5;        }        #p2 {            font-size:16px;        }

Structure:

<div class= "box" >    <p id= "P2" > Pig pig Piggy </p></div>

And then through

Console.log ($ ("#p2"). CSS ("Line-height"));

Gets the line height of p to 24.

The difference between line-height:150% and line-height:1.5

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.