UNPKG

1.38 kBMarkdownView Raw
1# declaration-block-no-shorthand-property-overrides
2
3Disallow shorthand properties that override related longhand properties.
4
5<!-- prettier-ignore -->
6```css
7a { background-repeat: repeat; background: green; }
8/** ↑
9 * This overrides the longhand property before it */
10```
11
12In 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
18The following patterns are considered violations:
19
20<!-- prettier-ignore -->
21```css
22a {
23 padding-left: 10px;
24 padding: 20px;
25}
26```
27
28<!-- prettier-ignore -->
29```css
30a {
31 transition-property: opacity;
32 transition: opacity 1s linear;
33}
34```
35
36<!-- prettier-ignore -->
37```css
38a {
39 -webkit-transition-property: opacity;
40 -webkit-transition: opacity 1s linear;
41}
42```
43
44<!-- prettier-ignore -->
45```css
46a {
47 border-top-width: 1px;
48 top: 0;
49 bottom: 3px;
50 border: 2px solid blue;
51}
52```
53
54The following patterns are _not_ considered violations:
55
56<!-- prettier-ignore -->
57```css
58a { padding: 10px; padding-left: 20px; }
59```
60
61<!-- prettier-ignore -->
62```css
63a { transition-property: opacity; } a { transition: opacity 1s linear; }
64```
65
66<!-- prettier-ignore -->
67```css
68a { transition-property: opacity; -webkit-transition: opacity 1s linear; }
69```