Skip to content

Commit ac660fd

Browse files
committed
Merge pull request Workable#2 from grigoria/patch-4
Inline comments clarification
2 parents 17a8bfd + 900e6ee commit ac660fd

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

README.md

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,6 @@ When using multiple selectors, every individual selector should have its own lin
5454
}
5555
```
5656

57-
There are some exceptions to this rule as well, for example, when you combine ultra-short selectors in a single line:
58-
59-
```css
60-
h2, .h2 {
61-
...
62-
}
63-
```
6457

6558
### Whitespace
6659

@@ -171,9 +164,23 @@ Don't forget to comment module elements as well:
171164
...
172165
}
173166
```
174-
175167
If you don't get the syntax/terminology above, don't worry - there's a whole section dedicated to BEM below.
176168

169+
Remember to use the syntax above to write a comment before a set of rules and not `//`. We use double slash only for inline comments (see below).
170+
171+
```
172+
/*
173+
Use this type
174+
*/
175+
.candidate {
176+
...
177+
}
178+
179+
// Instead of this
180+
.candidate {
181+
...
182+
}
183+
177184
#### Use inline comments for extras
178185
179186
Preprocessor (inline) comments can be used to specify the use of a specific declaration. They can be useful to denote todos or add quick tips for your future self.
@@ -186,6 +193,7 @@ Preprocessor (inline) comments can be used to specify the use of a specific decl
186193

187194
Again, don't worry about going overboard with commenting, since comments and whitespace are removed during minification and aren't visible in production.
188195

196+
189197
### Why not use IDs?
190198

191199
It might make sense to use an ID for a unique part of the page but believe me, you want to avoid it. Using IDs for styling increases the selector specificity immensely. If you want to override that styling at some point you have to use another ID (and probably nest it) or just slap `!important` on it and hope for the best.

0 commit comments

Comments
 (0)