blob: 367b9ee695a803bf25ae10ebb2e709156bb9be99 [file] [log] [blame]
avm99963a23bf1e2020-12-25 03:02:10 +01001/*
2 * Copyright 2014 The Chromium Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file.
5 *
6 * This stylesheet is used to apply Chrome styles to extension pages that opt in
7 * to using them.
8 *
9 * These styles have been copied from ui/webui/resources/css/chrome_shared.css
10 * and ui/webui/resources/css/widgets.css *with CSS class logic removed*, so
11 * that it's as close to a user-agent stylesheet as possible.
12 *
13 * For example, extensions shouldn't be able to set a .link-button class and
14 * have it do anything.
15 *
16 * Other than that, keep this file and chrome_shared.css/widgets.cc in sync as
17 * much as possible.
18 */
19
20body {
21 color: #333;
22 cursor: default;
23 /* Note that the correct font-family and font-size are set in
24 * extension_fonts.css. */
25 /* This top margin of 14px matches the top padding on the h1 element on
26 * overlays (see the ".overlay .page h1" selector in overlay.css), which
27 * every dialogue has.
28 *
29 * Similarly, the bottom 14px margin matches the bottom padding of the area
30 * which hosts the buttons (see the ".overlay .page * .action-area" selector
31 * in overlay.css).
32 *
33 * Both have a padding left/right of 17px.
34 *
35 * Note that we're putting this here in the Extension content, rather than
36 * the WebUI element which contains the content, so that scrollbars in the
37 * Extension content don't get a 6px margin, which looks quite odd.
38 */
39 margin: 14px 17px;
40}
41
42p {
43 line-height: 1.8em;
44}
45
46h1,
47h2,
48h3 {
49 -webkit-user-select: none;
50 font-weight: normal;
51 /* Makes the vertical size of the text the same for all fonts. */
52 line-height: 1;
53}
54
55h1 {
56 font-size: 1.5em;
57}
58
59h2 {
60 font-size: 1.3em;
61 margin-bottom: 0.4em;
62}
63
64h3 {
65 color: black;
66 font-size: 1.2em;
67 margin-bottom: 0.8em;
68}
69
70a {
71 color: rgb(17, 85, 204);
72 text-decoration: underline;
73}
74
75a:active {
76 color: rgb(5, 37, 119);
77}
78
79/* Default state **************************************************************/
80
81:-webkit-any(button,
82 input[type='button'],
83 input[type='submit']),
84select,
85input[type='checkbox'],
86input[type='radio'] {
87 -webkit-appearance: none;
88 -webkit-user-select: none;
89 background-image: linear-gradient(#ededed, #ededed 38%, #dedede);
90 border: 1px solid rgba(0, 0, 0, 0.25);
91 border-radius: 2px;
92 box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08),
93 inset 0 1px 2px rgba(255, 255, 255, 0.75);
94 color: #444;
95 font: inherit;
96 margin: 0 1px 0 0;
97 outline: none;
98 text-shadow: 0 1px 0 rgb(240, 240, 240);
99}
100
101:-webkit-any(button,
102 input[type='button'],
103 input[type='submit']),
104select {
105 min-height: 2em;
106 min-width: 4em;
107<if expr="is_win">
108 /* The following platform-specific rule is necessary to get adjacent
109 * buttons, text inputs, and so forth to align on their borders while also
110 * aligning on the text's baselines. */
111 padding-bottom: 1px;
112</if>
113}
114
115:-webkit-any(button,
116 input[type='button'],
117 input[type='submit']) {
118 -webkit-padding-end: 10px;
119 -webkit-padding-start: 10px;
120}
121
122select {
123 -webkit-appearance: none;
124 -webkit-padding-end: 20px;
125 -webkit-padding-start: 6px;
126 /* OVERRIDE */
127 background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAAICAQAAACxSAwfAAAAUUlEQVR4AWP4TxREZkYxpKHAKKzKEhOZvyG4zN8SE7Eq+6+wYCHbTwiT7eeChf8VsFsKVQhTxIDDbVCFfF8ginApgyp82wRShEcZVJIVzoJDAGqrgIJGRl20AAAAAElFTkSuQmCC),
128 linear-gradient(#ededed, #ededed 38%, #dedede);
129 background-position: right center;
130 background-repeat: no-repeat;
131}
132
133html[dir='rtl'] select {
134 background-position: center left;
135}
136
137input[type='checkbox'] {
138 height: 13px;
139 position: relative;
140 vertical-align: middle;
141 width: 13px;
142}
143
144input[type='radio'] {
145 /* OVERRIDE */
146 border-radius: 100%;
147 height: 15px;
148 position: relative;
149 vertical-align: middle;
150 width: 15px;
151}
152
153/* TODO(estade): add more types here? */
154input[type='number'],
155input[type='password'],
156input[type='search'],
157input[type='text'],
158input[type='url'],
159input:not([type]),
160textarea {
161 border: 1px solid #bfbfbf;
162 border-radius: 2px;
163 box-sizing: border-box;
164 color: #444;
165 font: inherit;
166 margin: 0;
167 /* Use min-height to accommodate addditional padding for touch as needed. */
168 min-height: 2em;
169 padding: 3px;
170 outline: none;
171<if expr="is_win or is_macosx or is_ios">
172 /* For better alignment between adjacent buttons and inputs. */
173 padding-bottom: 4px;
174</if>
175}
176
177input[type='search'] {
178 -webkit-appearance: textfield;
179 /* NOTE: Keep a relatively high min-width for this so we don't obscure the end
180 * of the default text in relatively spacious languages (i.e. German). */
181 min-width: 160px;
182}
183
184/* Checked ********************************************************************/
185
186input[type='checkbox']:checked::before {
187 -webkit-user-select: none;
188 background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAALCAQAAAADpb+tAAAAZ0lEQVR4AWNAA2xAiAXEM8xiMEAXVGJYz7AZCFEkmBi6wYKtEC4/gxqY9gILrmYQhwiXMWxkiAVyVoOFfSCCpkAmCK4Fk+1QA4GqekECUAMkka0KY9gIFvZDd5oawwyGBqACdIDqOwAQzBnTWnnU+gAAAABJRU5ErkJggg==);
189 background-size: 100% 100%;
190 content: '';
191 display: block;
192 height: 100%;
193 width: 100%;
194}
195
196input[type='radio']:checked::before {
197 background-color: #666;
198 border-radius: 100%;
199 bottom: 3px;
200 content: '';
201 display: block;
202 left: 3px;
203 position: absolute;
204 right: 3px;
205 top: 3px;
206}
207
208/* Hover **********************************************************************/
209
210:enabled:hover:-webkit-any(
211 select,
212 input[type='checkbox'],
213 input[type='radio'],
214 :-webkit-any(
215 button,
216 input[type='button'],
217 input[type='submit'])) {
218 background-image: linear-gradient(#f0f0f0, #f0f0f0 38%, #e0e0e0);
219 border-color: rgba(0, 0, 0, 0.3);
220 box-shadow: 0 1px 0 rgba(0, 0, 0, 0.12),
221 inset 0 1px 2px rgba(255, 255, 255, 0.95);
222 color: black;
223}
224
225:enabled:hover:-webkit-any(select) {
226 /* OVERRIDE */
227 background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAAICAQAAACxSAwfAAAAUUlEQVR4AWP4TxREZkYxpKHAKKzKEhOZvyG4zN8SE7Eq+6+wYCHbTwiT7eeChf8VsFsKVQhTxIDDbVCFfF8ginApgyp82wRShEcZVJIVzoJDAGqrgIJGRl20AAAAAElFTkSuQmCC),
228 linear-gradient(#f0f0f0, #f0f0f0 38%, #e0e0e0);
229}
230
231/* Active *********************************************************************/
232
233:enabled:active:-webkit-any(
234 select,
235 input[type='checkbox'],
236 input[type='radio'],
237 :-webkit-any(
238 button,
239 input[type='button'],
240 input[type='submit'])) {
241 background-image: linear-gradient(#e7e7e7, #e7e7e7 38%, #d7d7d7);
242 box-shadow: none;
243 text-shadow: none;
244}
245
246:enabled:active:-webkit-any(select) {
247 /* OVERRIDE */
248 background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAAICAQAAACxSAwfAAAAUUlEQVR4AWP4TxREZkYxpKHAKKzKEhOZvyG4zN8SE7Eq+6+wYCHbTwiT7eeChf8VsFsKVQhTxIDDbVCFfF8ginApgyp82wRShEcZVJIVzoJDAGqrgIJGRl20AAAAAElFTkSuQmCC),
249 linear-gradient(#e7e7e7, #e7e7e7 38%, #d7d7d7);
250}
251
252/* Disabled *******************************************************************/
253
254:disabled:-webkit-any(
255 button,
256 input[type='button'],
257 input[type='submit']),
258select:disabled {
259 background-image: linear-gradient(#f1f1f1, #f1f1f1 38%, #e6e6e6);
260 border-color: rgba(80, 80, 80, 0.2);
261 box-shadow: 0 1px 0 rgba(80, 80, 80, 0.08),
262 inset 0 1px 2px rgba(255, 255, 255, 0.75);
263 color: #aaa;
264}
265
266select:disabled {
267 /* OVERRIDE */
268 background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAAICAQAAACxSAwfAAAASUlEQVR4AWP4TxREZkYxpKHAKKzKEhMb/iPDxESsyv4rLFiIULRg4X8F7JaCFSIUMeBwG1QhTBEuZVCFb5tAivAog0qywllwCAAavoiLhz+UlAAAAABJRU5ErkJggg==),
269 linear-gradient(#f1f1f1, #f1f1f1 38%, #e6e6e6);
270}
271
272input:disabled:-webkit-any([type='checkbox'],
273 [type='radio']) {
274 opacity: .75;
275}
276
277input:disabled:-webkit-any([type='password'],
278 [type='search'],
279 [type='text'],
280 [type='url'],
281 :not([type])) {
282 color: #999;
283}
284
285/* Focus **********************************************************************/
286
287:enabled:focus:-webkit-any(
288 select,
289 input[type='checkbox'],
290 input[type='number'],
291 input[type='password'],
292 input[type='radio'],
293 input[type='search'],
294 input[type='text'],
295 input[type='url'],
296 input:not([type]),
297 :-webkit-any(
298 button,
299 input[type='button'],
300 input[type='submit'])) {
301 /* OVERRIDE */
302 -webkit-transition: border-color 200ms;
303 /* We use border color because it follows the border radius (unlike outline).
304 * This is particularly noticeable on mac. */
305 border-color: rgb(77, 144, 254);
306 outline: none;
307}
308
309/* Checkbox/radio helpers ******************************************************
310 *
311 * .checkbox and .radio classes wrap labels. Checkboxes and radios should use
312 * these classes with the markup structure:
313 *
314 * <div class="checkbox">
315 * <label>
316 * <input type="checkbox">
317 * <span>
318 * </label>
319 * </div>
320 */
321
322:-webkit-any(.checkbox, .radio) label {
323 /* Don't expand horizontally: <http://crbug.com/112091>. */
324 align-items: center;
325 display: inline-flex;
326 padding-bottom: 7px;
327 padding-top: 7px;
328}
329
330:-webkit-any(.checkbox, .radio) label input {
331 flex-shrink: 0;
332}
333
334:-webkit-any(.checkbox, .radio) label input ~ span {
335 -webkit-margin-start: 0.6em;
336 /* Make sure long spans wrap at the same horizontal position they start. */
337 display: block;
338}
339
340:-webkit-any(.checkbox, .radio) label:hover {
341 color: black;
342}
343
344label > input:disabled:-webkit-any([type='checkbox'], [type='radio']) ~ span {
345 color: #999;
346}