_reboot.scss 6.64 KB
Newer Older
Mark Otto's avatar
Mark Otto committed
1
// Reboot
2
//
Mark Otto's avatar
Mark Otto committed
3
4
// Global resets to common HTML elements and more for easier usage by Bootstrap.
// Builds on the resets of Normalize.css.
Jacob Thornton's avatar
Jacob Thornton committed
5

6

Mark Otto's avatar
Mark Otto committed
7
// Reset the box-sizing
8
//
9
10
11
12
13
// Change from `box-sizing: content-box` to `border-box` so that when you add
// `padding` or `border`s to an element, the overall declared `width` does not
// change. For example, `width: 100px;` will always be `100px` despite the
// `border: 10px solid red;` and `padding: 20px;`.
//
Mark Otto's avatar
Mark Otto committed
14
15
16
17
// Heads up! This reset may cause conflicts with some third-party widgets. For
// recommendations on resolving such conflicts, see
// http://getbootstrap.com/getting-started/#third-box-sizing.
//
18
// Credit: shttp://css-tricks.com/inheriting-box-sizing-probably-slightly-better-best-practice/
19

Chris Rebert's avatar
Chris Rebert committed
20
21
22
html {
  box-sizing: border-box;
}
23

24
*,
25
26
*:before,
*:after {
Chris Rebert's avatar
Chris Rebert committed
27
  box-sizing: inherit;
Mark Otto's avatar
Mark Otto committed
28
29
30
}


31
32
// Make viewport responsive
//
Mark Otto's avatar
Mark Otto committed
33
34
35
36
// @viewport is needed because IE 10+ doesn't honor <meta name="viewport"> in
// some cases. See http://timkadlec.com/2012/10/ie10-snap-mode-and-responsive-design/.
// Eventually @viewport will replace <meta name="viewport">. It's been manually
// prefixed for forward-compatibility.
37
38
//
// However, `device-width` is broken on IE 10 on Windows (Phone) 8,
Mark Otto's avatar
Mark Otto committed
39
40
41
42
// (see http://timkadlec.com/2013/01/windows-phone-8-and-device-width/ and https://github.com/twbs/bootstrap/issues/10497)
// and the fix for that involves a snippet of JavaScript to sniff the user agent
// and apply some conditional CSS.
//
43
44
45
46
47
48
49
50
51
// See http://getbootstrap.com/getting-started/#support-ie10-width for the relevant hack.

@-moz-viewport      { width: device-width; }
@-ms-viewport       { width: device-width; }
@-o-viewport        { width: device-width; }
@-webkit-viewport   { width: device-width; }
@viewport           { width: device-width; }


52
//
53
// Reset HTML, body, and more
54
//
Jacob Thornton's avatar
Jacob Thornton committed
55

56
html {
57
  // Sets a specific default `font-size` for user with `rem` type scales.
Mark Otto's avatar
Mark Otto committed
58
  font-size: $font-size-root;
59
  // Changes the default tap highlight to be completely transparent in iOS.
60
61
62
  -webkit-tap-highlight-color: rgba(0,0,0,0);
}

Jacob Thornton's avatar
Jacob Thornton committed
63
body {
64
  // Make the `body` use the `font-size-root`
Mark Otto's avatar
Mark Otto committed
65
66
67
  font-family: $font-family-base;
  font-size: $font-size-base;
  line-height: $line-height-base;
68
  // Go easy on the eyes and use something other than `#000` for text
Mark Otto's avatar
Mark Otto committed
69
  color: $text-color;
70
  // By default, `<body>` has no `background-color` so we set one as a best practice.
Mark Otto's avatar
Mark Otto committed
71
  background-color: $body-bg;
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

//
// Typography
//

// Remove top margins from headings
//
// By default, `<h1>`-`<h6>` all receive top and bottom margins. We nuke the top
// margin for easier control within type scales as it avoids margin collapsing.
h1, h2, h3, h4, h5, h6 {
  margin-top: 0;
  margin-bottom: .5rem;
}

// Reset margins on paragraphs
//
// Similarly, the top margin on `<p>`s get reset. However, we also reset the
// bottom margin to use `rem` units instead of `em`.
p {
  margin-top: 0;
  margin-bottom: 1rem;
}

97
98
99
100
// Abbreviations and acronyms
abbr[title],
// Add data-* attribute to help out our tooltip plugin, per https://github.com/twbs/bootstrap/issues/5257
abbr[data-original-title] {
101
  cursor: help;
102
  border-bottom: 1px dotted $abbr-border-color;
103
104
105
106
107
}

address {
  margin-bottom: 1rem;
  font-style: normal;
Mark Otto's avatar
Mark Otto committed
108
  line-height: inherit;
Jacob Thornton's avatar
Jacob Thornton committed
109
110
}

111
112
113
114
115
116
ol,
ul,
dl {
  margin-top: 0;
  margin-bottom: 1rem;
}
117

118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
ol ol,
ul ul,
ol ul,
ul ol {
  margin-bottom: 0;
}

dt {
  font-weight: bold;
}

dd {
  margin-left: 0; // Undo browser default
  margin-bottom: .5rem;
}

blockquote {
  margin: 0 0 1rem;
}


//
140
// Links
141
//
Jacob Thornton's avatar
Jacob Thornton committed
142
143

a {
Mark Otto's avatar
Mark Otto committed
144
  color: $link-color;
Jacob Thornton's avatar
Jacob Thornton committed
145
  text-decoration: none;
Zlatan Vasović's avatar
Zlatan Vasović committed
146

147
  @include hover-focus {
Mark Otto's avatar
Mark Otto committed
148
149
    color: $link-hover-color;
    text-decoration: $link-hover-decoration;
Zlatan Vasović's avatar
Zlatan Vasović committed
150
151
152
  }

  &:focus {
Mark Otto's avatar
Mark Otto committed
153
    @include tab-focus();
Zlatan Vasović's avatar
Zlatan Vasović committed
154
  }
Mark Otto's avatar
Mark Otto committed
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
//
// Code
//

pre {
  // Remove browser default top margin
  margin-top: 0;
  // Reset browser default of `1em` to use `rem`s
  margin-bottom: 1rem;
}


//
// Figures
//

figure {
  // Normalize adds `margin` to `figure`s as browsers apply it inconsistently.
  // We reset that to create a better flow in-page.
  margin: 0 0 1rem;
}



//
183
// Images
184
//
185

Mark Otto's avatar
Mark Otto committed
186
img {
187
188
  // By default, `<img>`s are `inline-block`. This assumes that, and vertically
  // centers them. This won't apply should you reset them to `block` level.
Mark Otto's avatar
Mark Otto committed
189
190
191
  vertical-align: middle;
}

192

Mark Otto's avatar
Mark Otto committed
193
194
195
196
197
198
199
200
201
202
// iOS "clickable elements" fix for role="button"
//
// Fixes "clickability" issue (and more generally, the firing of events such as focus as well)
// for traditionally non-focusable elements with role="button"
// see https://developer.mozilla.org/en-US/docs/Web/Events/click#Safari_Mobile
// Upstream patch for normalize.css submitted: https://github.com/necolas/normalize.css/pull/379 - remove this fix once that is merged

[role="button"] {
  cursor: pointer;
}
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
234


//
// Tables
//

table {
  // Reset for nesting within parents with `background-color`.
  background-color: $table-bg;
}

caption {
  caption-side: bottom;
  padding-top: $table-cell-padding;
  padding-bottom: $table-cell-padding;
  color: $text-muted;
  text-align: left;
}

th {
  // Centered by default, but left-align-ed to match the `td`s below.
  text-align: left;
}


//
// Forms
//

label {
  // Allow labels can use `margin` for spacing.
  display: inline-block;
235
  margin-bottom: .5rem;
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
}

input,
button,
select,
textarea {
  // Remove all `margin`s so our classes don't have to do it themselves.
  margin: 0;
  // Normalize includes `font: inherit;`, so `font-family`. `font-size`, etc are
  // properly inherited. However, `line-height` isn't addressed there. Using this
  // ensures we don't need to unnessarily redeclare the global font stack.
  line-height: inherit;
}

textarea {
  // Textareas should really only resize vertically so they don't break their (horizontal) containers.
  resize: vertical;
}

fieldset {
  // Reset the default outline behavior of fieldsets so they don't affect page layout.
  padding: 0;
  margin: 0;
  border: 0;
  // Chrome and Firefox set a `min-width: min-content;` on fieldsets,
  // so we reset that to ensure it behaves more like a standard block element.
  // See https://github.com/twbs/bootstrap/issues/12359.
  min-width: 0;
}

legend {
  // Reset the entire legend element to match the `fieldset`
  display: block;
  width: 100%;
  padding: 0;
  margin-bottom: .5rem;
  font-size: 1.5rem;
  line-height: inherit;
//  border: 0;
}

input[type="search"] {
278
279
280
281
282
  // This overrides the extra rounded corners on search inputs in iOS so that our
  // `.form-control` class can properly style them. Note that this cannot simply
  // be added to `.form-control` as it's not specific enough. For details, see
  // https://github.com/twbs/bootstrap/issues/11586.
  -webkit-appearance: none;
283
284
285
286
}

// todo: needed?
output {
287
  display: inline-block;
288
289
290
291
//  font-size: $font-size-base;
//  line-height: $line-height-base;
//  color: $input-color;
}