useLogicalProperties (CSS)
Language CSS
Summary
Section titled “Summary”- Diagnostic Category:
lint/nursery/useLogicalProperties - This rule doesn’t have a fix.
- The default severity of this rule is warning.
How to configure
Section titled “How to configure”{ "linter": { "rules": { "nursery": { "useLogicalProperties": "error" } } }}Description
Section titled “Description”Enforce logical properties over physical properties.
Physical properties such as width, height, top, left, margin-top, padding-left,
border-top, border-left-color, etc. are tied to writing direction. Logical properties such
as inline-size, block-size, inset-block-start, margin-block-start,
padding-inline-end, border-block-start, border-inline-start-color, etc. adapt more
consistently across different writing modes.
Examples
Section titled “Examples”Invalid
Section titled “Invalid”p { width: 100%;}code-block.css:2:3 lint/nursery/useLogicalProperties ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚠ Use logical CSS properties over physical ones.
1 │ p {
> 2 │ width: 100%;
│ ^^^^^
3 │ }
4 │
ℹ Logical properties adapt better to different writing modes and layout directions.
ℹ Replace width with inline-size.
ℹ This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.
p { top: 0;}code-block.css:2:3 lint/nursery/useLogicalProperties ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚠ Use logical CSS properties over physical ones.
1 │ p {
> 2 │ top: 0;
│ ^^^
3 │ }
4 │
ℹ Logical properties adapt better to different writing modes and layout directions.
ℹ Replace top with inset-block-start.
ℹ This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.
p { margin-left: 1rem;}code-block.css:2:3 lint/nursery/useLogicalProperties ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚠ Use logical CSS properties over physical ones.
1 │ p {
> 2 │ margin-left: 1rem;
│ ^^^^^^^^^^^
3 │ }
4 │
ℹ Logical properties adapt better to different writing modes and layout directions.
ℹ Replace margin-left with margin-inline-start.
ℹ This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.
p { border-left: 1px solid;}code-block.css:2:3 lint/nursery/useLogicalProperties ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚠ Use logical CSS properties over physical ones.
1 │ p {
> 2 │ border-left: 1px solid;
│ ^^^^^^^^^^^
3 │ }
4 │
ℹ Logical properties adapt better to different writing modes and layout directions.
ℹ Replace border-left with border-inline-start.
ℹ This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.
p { inline-size: 100%; inset-block-start: 0; margin-inline-start: 1rem; border-inline-start: 1px solid;}Options
Section titled “Options”direction
Section titled “direction”The text direction used to map physical inline properties. It can be either "ltr" or
"rtl". Defaults to "ltr".
{ "linter": { "rules": { "nursery": { "useLogicalProperties": { "level": "on", "options": { "direction": "rtl" } } } } }}Invalid
Section titled “Invalid”p { margin-left: 1rem;}code-block.css:2:3 lint/nursery/useLogicalProperties ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚠ Use logical CSS properties over physical ones.
1 │ p {
> 2 │ margin-left: 1rem;
│ ^^^^^^^^^^^
3 │ }
4 │
ℹ Logical properties adapt better to different writing modes and layout directions.
ℹ Replace margin-left with margin-inline-end.
ℹ This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.
p { margin-inline-end: 1rem;}Related links
Section titled “Related links”Copyright (c) 2023-present Biome Developers and Contributors.