1 | # selector-attribute-brackets-space-inside
|
2 |
|
3 | Require a single space or disallow whitespace on the inside of the brackets within attribute selectors.
|
4 |
|
5 |
|
6 | ```css
|
7 | [ target=_blank ]
|
8 | /** ↑ ↑
|
9 | * The space inside these two brackets */
|
10 | ```
|
11 |
|
12 | The [`fix` option](../../../docs/user-guide/usage/options.md#fix) can automatically fix all of the problems reported by this rule.
|
13 |
|
14 | ## Options
|
15 |
|
16 | `string`: `"always"|"never"`
|
17 |
|
18 | ### `"always"`
|
19 |
|
20 | There _must always_ be a single space inside the brackets.
|
21 |
|
22 | The following patterns are considered violations:
|
23 |
|
24 |
|
25 | ```css
|
26 | [target] {}
|
27 | ```
|
28 |
|
29 |
|
30 | ```css
|
31 | [ target] {}
|
32 | ```
|
33 |
|
34 |
|
35 | ```css
|
36 | [target ] {}
|
37 | ```
|
38 |
|
39 |
|
40 | ```css
|
41 | [target=_blank] {}
|
42 | ```
|
43 |
|
44 |
|
45 | ```css
|
46 | [ target=_blank] {}
|
47 | ```
|
48 |
|
49 |
|
50 | ```css
|
51 | [target=_blank ] {}
|
52 | ```
|
53 |
|
54 | The following patterns are _not_ considered violations:
|
55 |
|
56 |
|
57 | ```css
|
58 | [ target ] {}
|
59 | ```
|
60 |
|
61 |
|
62 | ```css
|
63 | [ target=_blank ] {}
|
64 | ```
|
65 |
|
66 | ### `"never"`
|
67 |
|
68 | There _must never_ be whitespace on the inside the brackets.
|
69 |
|
70 | The following patterns are considered violations:
|
71 |
|
72 |
|
73 | ```css
|
74 | [ target] {}
|
75 | ```
|
76 |
|
77 |
|
78 | ```css
|
79 | [target ] {}
|
80 | ```
|
81 |
|
82 |
|
83 | ```css
|
84 | [ target ] {}
|
85 | ```
|
86 |
|
87 |
|
88 | ```css
|
89 | [ target=_blank] {}
|
90 | ```
|
91 |
|
92 |
|
93 | ```css
|
94 | [target=_blank ] {}
|
95 | ```
|
96 |
|
97 |
|
98 | ```css
|
99 | [ target=_blank ] {}
|
100 | ```
|
101 |
|
102 | The following patterns are _not_ considered violations:
|
103 |
|
104 |
|
105 | ```css
|
106 | [target] {}
|
107 | ```
|
108 |
|
109 |
|
110 | ```css
|
111 | [target=_blank] {}
|
112 | ```
|