From c61bb25c1460487eba318d0de796a85db2a3ad5a Mon Sep 17 00:00:00 2001 From: wbamberg Date: Wed, 3 Apr 2024 14:12:37 -0700 Subject: [PATCH] Fix 32896: make relative length units look less exhaustive --- .../building_blocks/values_and_units/index.md | 87 ++----------------- 1 file changed, 7 insertions(+), 80 deletions(-) diff --git a/files/en-us/learn/css/building_blocks/values_and_units/index.md b/files/en-us/learn/css/building_blocks/values_and_units/index.md index c40cadd67c157f3..00bd3fc29072571 100644 --- a/files/en-us/learn/css/building_blocks/values_and_units/index.md +++ b/files/en-us/learn/css/building_blocks/values_and_units/index.md @@ -148,87 +148,14 @@ Most of these units are more useful when used for print, rather than screen outp #### Relative length units -Relative length units are relative to something else, perhaps the size of the parent element's font, or the size of the viewport. The benefit of using relative units is that with some careful planning you can make it so the size of text or other elements scales relative to everything else on the page. Some of the most useful units for web development are listed in the table below. +Relative length units are relative to something else. For example: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
UnitRelative to
em - Font size of the parent, in the case of typographical properties like - font-size, and font size of the element itself, in the case of other properties - like width. -
exx-height of the element's font.
ch - The advance measure (width) of the glyph "0" of the element's font. -
remFont size of the root element.
lhLine height of the element.
rlhLine height of the root element. When used on the font-size or line-height properties of the root element, it refers to the properties' initial value.
vw1% of the viewport's width.
vh1% of the viewport's height.
vmin1% of the viewport's smaller dimension.
vmax1% of the viewport's larger dimension.
vb1% of the size of the initial containing block in the direction of the root element's block axis.
vi1% of the size of the initial containing block in the direction of the root element's inline axis.
svw, svh1% of the small viewport's width and height, respectively.
lvw, lvh1% of the large viewport's width and height, respectively.
dvw, dvh1% of the dynamic viewport's width and height, respectively.
+- `em` and `rem` are relative to the font size of the parent element and the root element, respectively. +- `vh` and `vw` are relative to the viewport's height and width, respectively. + +The benefit of using relative units is that with some careful planning you can make it so the size of text or other elements scales relative to everything else on the page. For a complete list of the relative units available, see the reference page for the {{cssxref("length")}} type. + +In this section we'll explore some of the most common relative units. #### Exploring an example