/
beautons.css
233 lines (192 loc) · 4.95 KB
/
beautons.css
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
/*------------------------------------*\
$BEAUTONS.CSS
\*------------------------------------*/
/**
* beautons is a beautifully simple button toolkit.
*
* LICENSE
*
* Copyright 2013 Harry Roberts
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
/*!*
*
* @csswizardry -- csswizardry.com/beautons
*
*/
/*------------------------------------*\
$BASE
\*------------------------------------*/
/**
* Base button styles.
*
* 1. Allow us to better style box model properties.
* 2. Line different sized buttons up a little nicer.
* 3. Stop buttons wrapping and looking broken.
* 4. Make buttons inherit font styles.
* 5. Force all elements using beautons to appear clickable.
* 6. Normalise box model styles.
* 7. If the button’s text is 1em, and the button is (3 * font-size) tall, then
* there is 1em of space above and below that text. We therefore apply 1em
* of space to the left and right, as padding, to keep consistent spacing.
* 8. Basic cosmetics for default buttons. Change or override at will.
* 9. Unfortunately, `line-height` won’t work on `input`s in Firefox, use a
* `button` element instead.
* 10. Don’t allow buttons to have underlines; it kinda ruins the illusion.
*/
.btn{
display:inline-block; /* [1] */
vertical-align:middle; /* [2] */
white-space:nowrap; /* [3] */
font-family:inherit; /* [4] */
font-size:100%; /* [4] */
cursor:pointer; /* [5] */
border:none; /* [6] */
margin:0; /* [6] */
padding-top: 0; /* [6] */
padding-bottom:0; /* [6] */
line-height:3; /* [7] */
padding-right:1em; /* [7] */
padding-left: 1em; /* [7] */
color:#fff; /* [8] */
background-color:#2c77ba; /* [8] */
border-radius:4px; /* [8] */
}
input.btn{
outline:10px solid red; /* [9] */
}
.btn,
.btn:hover{
text-decoration:none; /* [10] */
}
.btn:hover{
box-shadow:0 0 5px rgba(0, 0, 0, 0.5);
}
.btn:active,
.btn:focus{
outline:none;
box-shadow:0 0 5px rgba(0, 0, 0, 0.5) inset;
}
/*------------------------------------*\
$SIZES
\*------------------------------------*/
/**
* Button size modifiers.
*
* These all follow the same sizing rules as above; text is 1em, space around it
* remains uniform.
*/
.btn--small{
padding-right:0.5em;
padding-left: 0.5em;
line-height:2;
}
.btn--large{
padding-right:1.5em;
padding-left: 1.5em;
line-height:4;
}
.btn--huge{
padding-right:2em;
padding-left: 2em;
line-height:5;
}
/**
* These buttons will fill the entirety of their container.
*
* 1. Remove padding so that widths and paddings don’t conflict.
*/
.btn--full{
width:100%;
padding-right:0; /* [1] */
padding-left: 0; /* [1] */
text-align:center;
}
/*------------------------------------*\
$FONT-SIZES
\*------------------------------------*/
/**
* Button font-size modifiers.
*/
.btn--alpha{
font-size:3rem;
}
.btn--beta{
font-size:2rem;
}
.btn--gamma{
font-size:1rem;
}
/**
* Make the button inherit sizing from its parent.
*/
.btn--natural{
vertical-align:baseline;
font-size:inherit;
line-height:inherit;
padding-right:0.5em;
padding-left: 0.5em;
}
/*------------------------------------*\
$FUNCTIONS
\*------------------------------------*/
/**
* Button function modifiers.
*/
.btn--primary{}
.btn--secondary{}
.btn--tertiary{}
/**
* Positive actions; e.g. sign in, purchase, submit, etc.
*/
.btn--positive{
background-color:#4A993E;
color:#fff;
}
/**
* Negative actions; e.g. close account, delete photo, remove friend, etc.
*/
.btn--negative{
background-color:#b33630;
color:#fff;
}
/**
* Inactive, disabled buttons.
*
* 1. Make the button look like normal text when hovered.
*/
.btn--inactive,
.btn--inactive:hover,
.btn--inactive:active,
.btn--inactive:focus{
background-color:#ddd;
color:#777;
cursor:text; /* [1] */
box-shadow:none;
}
/*------------------------------------*\
$STYLES
\*------------------------------------*/
/**
* Button style modifiers.
*
* 1. Use an overly-large number to ensure completely rounded, pill-like ends.
*/
.btn--soft{
border-radius:200px; /* [1] */
}
.btn--hard{
border-radius:0;
}