You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sort CSS properties into logical groups with [stylelint-order](https://github.com/hudochenkov/stylelint-order).
9
+
10
+
```css
11
+
.card {
12
+
/* Interaction */
13
+
cursor: pointer;
14
+
15
+
/* Positioning */
16
+
position: relative;
17
+
z-index: 1;
18
+
19
+
/* Layout */
20
+
display: flex;
21
+
flex-direction: column;
22
+
gap: var(--spacing-sm);
23
+
24
+
/* Box Model */
25
+
width: 100%;
26
+
padding: var(--spacing-md);
27
+
border-radius: var(--radius-md);
28
+
29
+
/* Typography */
30
+
font-size: var(--font-size-base);
31
+
line-height: var(--line-height-normal);
32
+
color: var(--color-text);
33
+
34
+
/* Appearance */
35
+
opacity: 1;
36
+
background-color: var(--color-bg);
37
+
box-shadow: var(--shadow-md);
38
+
39
+
/* Transition */
40
+
transition: transform var(--duration-fast);
41
+
}
42
+
```
13
43
14
44
## Usage
15
45
@@ -28,7 +58,7 @@ export default {
28
58
}
29
59
```
30
60
31
-
That's it! Now your styles will be ordered! You can use `stylelint --fix`command to automatically fix order issues.
61
+
Run `stylelint --fix` to automatically sort properties.
32
62
33
63
## Severity Options
34
64
@@ -77,9 +107,19 @@ In addition to `stylelint-order` plugin, this package also overrides two rules (
77
107
78
108
If you want these rules to put into effect, make sure config packages after `stylelint-config-clean-order` do not override them.
79
109
80
-
## About orders
110
+
## Property Order
111
+
112
+
Properties are organized into logical groups:
113
+
114
+
1.**Interaction**: `cursor`, `pointer-events`, `user-select`, etc.
115
+
2.**Positioning**: `position`, `z-index`, `top`, `right`, `bottom`, `left`, `transform`, etc.
116
+
3.**Layout**: `display`, `flex`, `grid`, `gap`, `align-items`, `justify-content`, etc.
117
+
4.**Box Model**: `width`, `height`, `margin`, `padding`, `border`, etc.
118
+
5.**Typography**: `font-size`, `line-height`, `color`, `text-align`, etc.
119
+
6.**Appearance**: `background`, `opacity`, `box-shadow`, `filter`, etc.
120
+
7.**Transition**: `transition`, `animation`, etc.
81
121
82
-
I try to hand-pick style orders in the most logical way to improve process of CSS refactoring; for example `font-size` before `line-height`, `display` before `align-items`. If you think order of a rule doesn't make sense, please open an issue so we can discuss. Thanks!
122
+
Within each group, properties are ordered logically (e.g., `font-size` before `line-height`, `display` before `align-items`). If you think a property order doesn't make sense, please open an issue.
0 commit comments