aboutsummaryrefslogtreecommitdiff
path: root/documentation/coding_standards/css_coding_standards.txt
blob: 195ca345b8acd51ef1a27bf1373126137c9a3381 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
*** CSS CODING STANDARDS ***

* 	Use shorthand where possible:
		Bad:
		background-color: #333333;
		background-image:  url(...);
		background-repeat:  repeat-x;
		background-position:  left 10px;
		padding: 2px 9px 2px 9px;

		Good:
		background: #333 url(...) repeat-x left 10px;
		padding: 2px 9px;

* 	Use hyphens as separators in classes/ids, not underscores:
		Bad:
		.example_class

		Good:
		.example-class

* 	One property per line
		Bad:
		color: white;font-size: smaller;

		Good:
		color: white;
		font-size: smaller;

* 	Property declarations should be spaced like so: `property: value;`
		Bad:
		color:value;
		color :value;
		color : value;

		Good:
		color: value;

* 	Group vendor-prefixes for the same property together:
* 	Longest vendor-prefixed version first:
* 	Always include non-vendor-prefixed version:
* 	Put an extra newline between vendor-prefixed groups and other properties:
		Bad:
		-moz-border-radius: 5px;
		border: 1px solid #999999;
		-webkit-border-radius: 5px;
		width: auto;

		Good:
		border: 1px solid #999999;

		-webkit-border-radius: 5px;
		-moz-border-radius: 5px;
		border-radius: 5px;

		width: auto;

* 	Group declarations of subproperties:
		Bad:
		background-color: white;
		color: #0054A7;
		background-position: 2px -257px;

		Good:
		background-color: white;
		background-position: 2px -257px;
		color: #0054A7;