CSS Data Type
Description
The <relative-size> CSS data type represents a value that is defined in relation to another length, typically the font size of the element itself or its parent. It is primarily used in typographic properties, allowing text or other elements to scale proportionally rather than using fixed units like pixels or points. Using <relative-size> ensures that designs remain more flexible and accessible, especially when users adjust their default font size in the browser.
This data type is often seen in properties such as font-size and line-height. Values of include keywords like larger, smaller, or combinations with numeric multipliers to scale elements relative to the parent. For example, setting font-size: larger; increases the text size relative to its parent, while smaller decreases it. This makes it particularly useful in responsive design, where content must adapt to different screen sizes and user preferences.
An important distinction is that <relative-size> differs from <length> or absolute units like pixels, because it does not define a fixed measurement. Instead, it relies on context, which means that the same keyword can result in different computed sizes depending on the surrounding elements. Additionally, combining <relative-size> with other CSS techniques, such as using the calc() function, allows developers to create dynamic and flexible layouts.
Here are a few examples:
/* Increase the font size relative to the parent */
p {
font-size: larger;
}
/* Decrease the font size relative to the parent */
small {
font-size: smaller;
}
/* Nested relative sizing */
div {
font-size: larger;
}
div p {
font-size: smaller; /* relative to the div's larger size */
}
The use of <relative-size> promotes scalability and readability while maintaining a relationship between nested elements, making it a core tool in adaptive typography and fluid design systems.
Syntax
<relative-size> = smaller | larger
Values
- smallerA relative size one size smaller than the inherited size.
- largerA relative size one size larger than the inherited size.
Example
Browser Support
The following information will show you the current browser support for the CSS relative-size data type. Hover over a browser icon to see the version that first introduced support for this CSS data type.
This data type is supported by all modern browsers.
Desktop
Tablets & Mobile
Last updated by CSSPortal on: 3rd January 2026
