Specify scales for font sizes.
a {
font-size: 1rem;
}
/** ↑
* This size */
This rule can automatically fix all of the problems reported.
This rule checks <length>
and <percentage>
values.
This rule can be paired with the declaration-property-unit-allowed-list
rule in stylelint, using the RegEx:
/^font-size$|^font$/
array
of objects
as {scale: [], units: []}
Given:
[
{ "scale": [1, 2], "units": ["em", "rem"] },
{ "scale": [16, 32], "units": ["px"] }
]
The following patterns are considered violations:
a {
font-size: 16rem;
}
a {
font: 2px/1 serif;
}
The following patterns are not considered violations:
a {
font-size: 1rem;
}
a {
font: 16px/1 serif;
}
Given:
[
[{ "scale": [1, 2], "units": ["rem"] }],
{
"ignoreFunctionArguments": { "clamp": [1], "min": [0, 1] }
}
]
The following patterns are not considered problems:
a {
font-size: clamp(1rem, 0.37rem + 0.45vw, 2rem);
}
a {
font-size: min(3rem, 4rem);
}