forked from rmhodges/code-style
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcss.css
More file actions
127 lines (91 loc) · 5.03 KB
/
css.css
File metadata and controls
127 lines (91 loc) · 5.03 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/*
CSS file conventions
This files lists and demonstrates some of the conventions and formatting we generally try to follow at WE7/blinkboxmusic.com
Unless there is a VERY good reason for it, all styling should be in a stylesheet seperate to the code, NOT in the html, NOT in the JS, not INLINE.
**************
Aside from overall and base styling, which gets put in primary.css, or page specific styling, which get put in pages.css, most sections
of a page are split up into components and have their own style sheets, the filename prefixed with "cmpt-". For example, a list of some of the current css files:
cmpt-dropdown.css
cmpt-pagination.css
cmpt-site-navbar.css
...
Particularly large pages, that have a lot of their own styling, can be given their own css file too, prefixed with "page-". For example:
page-ways-to-listen.css
page-static-comms.css
...
This splitting of code particularly helps to avoid merge errors as a result of developers working on one file at the same time as each other. It also helps with portability.
**************
*/
/* The beginning of each file should have a comment section, describing the component being styled. It can also be helpful to list original creation date, and the dates of any major edits and who did them. For example: */
/*
* Component Name
* Notes: blah blah blah
* 03/06/2013 - File Created - PS
* 10/07/2013 - New Design change - DG
*
*/
/* Sub sections can be headed like this */
/* We do not use id as selectors if we can avoid it */
#mainMenu { /* NO! */
}
/*
Always create a new class instead.
**************
All classes are given a readable sensible name, in all lower case, with space represented by - (dash).
The opening curly bracket should follow the class declaration on the same line, not on the next line.
For example:
**************
*/
.primary-header {
/* Styling */
}
.search-results-nav {
/* Styling */
}
/* We also try to make styling "tag agnostic", so that styling can be applied to different sorts of tags. For example, so a div can be given the same styling as an anchor */
a.bttn { /* NO! */
}
.bttn { /* YES! */
}
/* Sections of styling should be separated by 3 blank lines as above */
/* All declarations should be multi-line, unless they are single item OVERRIDES */
.player-bar .bttn {
color: #000;
font-size: 20px;
}
.player-bar .bttn:hover { color: #94130b; } /* Note the spacing here */
/* Some properties we like to put on one line, to save space and to group similar properties */
.player-bar .large-icon {
width: 80px; height: 90px; /* Width and height to mimic common XY ordering */
position: absolute;
top: 10px; right: 10px; /* Mimic margin/padding style ordering for this: TOP, RIGHT, BOTTOM, LEFT */
}
/* Grouping certain properties together, and placing sizing and position properties first can also help with readability */
.player-bar .favourites-list .header {
display: block; /* Size property */
width: 10px; height: 10px; /* Size property */
position: absolute; /* Position property */
top: 10px; left: 10px; /* Position property */
background: #94130b; /* Appearance Property */
color: #000; /* Appearance Property */
font-size: 20px; /* Appearance Property */
}
/* We do not generally format the css for alignment but it some cases it can be useful for readability, for example, when having a lot of overrides */
.player-bar .controls-block .control-button {
background: url(img/components/player-bar/player-bar-icons.png) 0 0 no-repeat;
}
.player-bar .controls-block .control-button.playing { background-position: 0 -45px; }
.player-bar .controls-block .control-button.playing:hover { background-position: 0 0; }
.player-bar .controls-block .control-button.paused { background-position: -135px -45px; }
.player-bar .controls-block .control-button.paused:hover { background-position: -135px 0; }
.player-bar .controls-block .control-button.skip { background-position: -45px -45px; }
.player-bar .controls-block .control-button.skip:hover { background-position: -45px 0; }
.player-bar .controls-block .volume-button { background-position: -90px -45px; }
.player-bar .controls-block .volume-button:hover { background-position: -90px 0; }
.player-bar .controls-block .volume-button.muted { background-position: -270px -45px; }
.player-bar .controls-block .volume-button.muted:hover { background-position: -270px 0; }
.player-bar .controls-block .volume-button.fiftypc { background-position: -180px -45px; }
.player-bar .controls-block .volume-button.fiftypc:hover { background-position: -180px 0; }
.player-bar .controls-block .volume-button.twentypc { background-position: -225px -45px; }
.player-bar .controls-block .volume-button.twentypc:hover { background-position: -225px 0; }
/* If in doubt on formatting, it is best to go with what is most readable */