CSS Line-height Properties

Source: Internet
Author: User
Tags numeric value
CSS Line-height Properties

CSS Reference Manual example

To set the row height as a percentage:

P.small {line-height:90%}
p.big {line-height:200%}

Give it a shot yourself.

(You can see more instances at the bottom of the page) browser support

IE Firefox Chrome Safari Opera

All browsers support the Line-height property.

Note: The property value "Inherit" is not supported for any version of Internet Explorer (including IE8). Definitions and Usage

The Line-height property sets the distance (row height) between rows.

Note: Negative values are not allowed. Description

This property affects the layout of the row box. When applied to a block-level element, it defines the minimum distance, not the maximum distance, between the baselines in the element.

The difference between the calculated value of Line-height and font-size (becoming "line spacing" in CSS) is divided into two halves, added to the top and bottom of a text line. The smallest box that can contain the content is the row box.

The original numeric value specifies a scaling factor, and the descendant element inherits the scaling factor rather than the computed value.

Default value: Normal
Inheritance: Yes
Version: CSS1
JavaScript Syntax: Object.style.lineheight= "2"
Possible values
value Description
Normal Default. Set reasonable line spacing.
Number Sets the number that is multiplied by the current font size to set the line spacing.
Length Sets the fixed line spacing.
% The percent line spacing based on the current font size.
Inherit Specify that the value of the Line-height attribute should be inherited from the parent element.
Tiy InstanceUse percentages to set line spacing This example shows how to use percent values to set the spacing between lines in a paragraph. Set line spacing using pixel values This example shows how to use pixel values to set the line spacing in a paragraph. Use numeric values to set line spacing This example shows how to use a numeric value to set the line spacing in a paragraph. related pages

CSS Tutorial: CSS text

HTML DOM Reference manual: Lineheight Properties

CSS Reference Manual

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.