YouTip LogoYouTip

Pr Dim Line Height

CSS line-height Property

CSS line-height Property

- Learn not just technology, but also dreams!

CSS Reference Manual

CSS Reference Manual CSS Selectors CSS Aural Reference CSS Web Safe Fonts CSS Animations CSS Functions CSS Units CSS Colors CSS Legal Color Values CSS Color Names CSS Color Hex Values CSS Browser Support Sass Tutorial

CSS Properties

align-content align-items align-self all animation animation-delay animation-direction animation-duration animation-fill-mode animation-iteration-count animation-name animation-play-state animation-timing-function appearance backface-visibility background background-attachment background-blend-mode background-clip background-color background-image background-origin background-position background-repeat background-size border border-bottom border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-collapse border-color border-image border-image-outset border-image-repeat border-image-slice border-image-source border-image-width border-left border-left-color border-left-style border-left-width border-radius border-right border-right-color border-right-style border-right-width border-spacing border-style border-top border-top-color border-top-left-radius border-top-right-radius border-top-style border-top-width border-width bottom box-align box-direction box-flex box-flex-group box-lines box-ordinal-group box-orient box-pack box-shadow box-sizing caption-side clear clip color column-count column-fill column-gap column-rule column-rule-color column-rule-style column-rule-width column-span column-width columns content counter-increment counter-reset cursor direction display empty-cells filter flex flex-basis flex-direction flex-flow flex-grow flex-shrink flex-wrap float font @font-face font-family font-size font-size-adjust font-stretch font-style font-variant font-weight grid grid-area grid-auto-columns grid-auto-flow grid-auto-rows grid-column grid-column-end grid-column-gap grid-column-start grid-gap grid-row grid-row-end grid-row-gap grid-row-start grid-template grid-template-areas grid-template-columns grid-template-rows top clear clip color column-count column-fill column-gap column-rule column-rule-color column-rule-style column-rule-width column-span column-width columns content counter-increment counter-reset cursor direction display empty-cells filter flex flex-basis flex-direction flex-flow flex-grow flex-shrink flex-wrap float font @font-face font-family font-size font-size-adjust font-stretch font-style font-variant font-weight gap hanging-punctuation height hyphens justify-content left letter-spacing line-height list-style list-style-image list-style-position list-style-type margin margin-bottom margin-left margin-right margin-top max-height max-width min-height min-width nav-down nav-index nav-left nav-right nav-up object-fit object-position opacity order outline outline-color outline-offset outline-style outline-width overflow overflow-wrap overflow-x overflow-y padding padding-bottom padding-left padding-right padding-top page-break-after page-break-before page-break-inside perspective perspective-origin position quotes right tab-size table-layout text-align text-align-last text-decoration text-decoration-color text-decoration-line text-decoration-style text-indent text-justify text-overflow text-shadow text-transform top transform transform-origin transform-style transition transition-delay transition-duration transition-property transition-timing-function unicode-bidi user-select vertical-align visibility white-space width word-break word-spacing word-wrap z-index

CSS line-height Property

Example

Set the line height:

p.small {line-height: 70%;}
p.big {line-height: 200%;}

Try it yourself »

Definition and Usage

The line-height property sets the line height.

The line height is the distance between lines of text. This property can be used to control the vertical spacing between text lines.

The line-height property accepts the following values:

  • normal - The default line height. This value depends on the browser.
  • number - The line height is multiplied by the current font size to set the line height.
  • length - Sets the line height using a fixed value, e.g., pixels, em units, etc.
  • % - The line height is calculated as a percentage of the current font size.
  • inherit - Specifies that the line height should be inherited from the parent element.

CSS Syntax

line-height: normal|number|length|%|initial|inherit;

Property Values

Value Description
normal The default line height. Typically 1.0 to 1.2, depending on the browser.
number The line height is multiplied by the current font size to calculate the line height.
length Defines the line height using a fixed value (e.g., pixels, em, rem, etc.). Negative values are not allowed.
% Defines the line height as a percentage of the current font size. Negative values are not allowed.
initial Sets this property to its default value.
inherit Inherits this property from its parent element.

More Examples

Example 1: Using line-height with a pixel value.

p {line-height: 20px;}

Example 2: Using line-height with an em value.

p {line-height: 1.5em;}

Example 3: Using line-height with a percentage value.

p {line-height: 150%;}

Browser Support

The line-height property is supported in all major browsers.

Property
line-height Yes Yes Yes Yes Yes

Related Properties

← Ng Ng Non BindableAngularjs Ng Mouseup β†’