Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. CSS
  3. Reference
  4. Values
  5. <absolute-size>

<absolute-size>

The<absolute-size>CSSdata type describes the absolute size keywords. This data type is used in thefont shorthand andfont-size properties.

The font size keywords are mapped to the deprecated HTMLsize attribute. See theHTML size attribute section below).

Syntax

<absolute-size> = xx-small | x-small | small | medium | large | x-large | xx-large | xxx-large

Values

The<absolute-size> data type is defined using a keyword value chosen from the list below.

xx-small

An absolute size 60% the size ofmedium. Mapped to the deprecatedsize="1".

x-small

An absolute size 75% the size ofmedium.

small

An absolute size 89% the size ofmedium. Mapped to the deprecatedsize="2".

medium

A user's preferred font size. This value is used as the reference middle value. Mapped tosize="3".

large

An absolute size 20% larger thanmedium. Mapped to the deprecatedsize="4".

x-large

An absolute size 50% larger thanmedium. Mapped to the deprecatedsize="5".

xx-large

An absolute size twice the size ofmedium. Mapped to the deprecatedsize="6".

xxx-large

An absolute size three times the size ofmedium. Mapped to the deprecatedsize="7".

Description

Each<absolute-size> keyword value is sized relative to themedium size and the individual device's characteristics, such as device resolution. User agents maintain a table of font sizes for each font, with the<absolute-size> keywords being the index.

In CSS1 (1996), the scaling factor between adjacent keyword value indexes was 1.5, which was too large. In CSS2 (1998), the scaling factor between adjacent keyword value indexes was 1.2, which created issues for the small values. As a single fixed ratio between adjacent absolute-size keywords was found to be problematic, there is no longer a fixed ratio recommendation. The only recommendation to preserve readability is that the smallest font size should not be less than9px.

For each<absolute-size> keyword value, the following table lists the scaling factor, mapping to<h1> to<h6> headings, and mapping to the deprecatedHTMLsize attribute.

<absolute-size>xx-smallx-smallsmallmediumlargex-largexx-largexxx-large
scaling factor3/53/48/916/53/22/13/1
HTML headingsh6h5h4h3h2h1
HTMLsize attribute1234567

HTML size attribute

Thesize attribute to set a font's size in HTML is deprecated. The attribute value was either an integer between1 and7 or a relative value. Relative values were an integer preceded by+ or- to increase or decrease the font size, respectively. A value of+1 meant increasing thesize by one and-2 meant decreasing the size by two, with the computed value clamped at a minimum of1 and a maximum computed value of7.

Examples

Comparing the keyword values

html
<ul>  <li>font-size: xx-small;</li>  <li>font-size: x-small;</li>  <li>font-size: small;</li>  <li>font-size: medium;</li>  <li>font-size: large;</li>  <li>font-size: x-large;</li>  <li>font-size: xx-large;</li>  <li>font-size: xxx-large;</li></ul>
css
li {  margin-bottom: 0.3em;}.xx-small {  font-size: xx-small;}.x-small {  font-size: x-small;}.small {  font-size: small;}.medium {  font-size: medium;}.large {  font-size: large;}.x-large {  font-size: x-large;}.xx-large {  font-size: xx-large;}.xxx-large {  font-size: xxx-large;}

Result

Specifications

Specification
CSS Fonts Module Level 4
# valdef-font-size-absolute-size

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp