1 | # declaration-block-no-shorthand-property-overrides
|
2 |
|
3 | Disallow shorthand properties that override related longhand properties.
|
4 |
|
5 |
|
6 | ```css
|
7 | a { background-repeat: repeat; background: green; }
|
8 | /** ↑
|
9 | * This overrides the longhand property before it */
|
10 | ```
|
11 |
|
12 | In almost every case, this is just an authorial oversight. For more about this behavior, see [MDN's documentation of shorthand properties](https://developer.mozilla.org/en-US/docs/Web/CSS/Shorthand_properties).
|
13 |
|
14 | ## Options
|
15 |
|
16 | ### `true`
|
17 |
|
18 | The following patterns are considered violations:
|
19 |
|
20 |
|
21 | ```css
|
22 | a {
|
23 | padding-left: 10px;
|
24 | padding: 20px;
|
25 | }
|
26 | ```
|
27 |
|
28 |
|
29 | ```css
|
30 | a {
|
31 | transition-property: opacity;
|
32 | transition: opacity 1s linear;
|
33 | }
|
34 | ```
|
35 |
|
36 |
|
37 | ```css
|
38 | a {
|
39 | -webkit-transition-property: opacity;
|
40 | -webkit-transition: opacity 1s linear;
|
41 | }
|
42 | ```
|
43 |
|
44 |
|
45 | ```css
|
46 | a {
|
47 | border-top-width: 1px;
|
48 | top: 0;
|
49 | bottom: 3px;
|
50 | border: 2px solid blue;
|
51 | }
|
52 | ```
|
53 |
|
54 | The following patterns are _not_ considered violations:
|
55 |
|
56 |
|
57 | ```css
|
58 | a { padding: 10px; padding-left: 20px; }
|
59 | ```
|
60 |
|
61 |
|
62 | ```css
|
63 | a { transition-property: opacity; } a { transition: opacity 1s linear; }
|
64 | ```
|
65 |
|
66 |
|
67 | ```css
|
68 | a { transition-property: opacity; -webkit-transition: opacity 1s linear; }
|
69 | ```
|