Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Side by Side Diff: chrome/browser/resources/shared/css/widgets.css

Issue 9609023: css hack n' slash, continued: New styles for checkboxes and radios. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix couple rtl bugs Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be 2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file. 3 * found in the LICENSE file.
4 */ 4 */
5 5
6 /* This file defines styles for form controls. The order of rule blocks is
7 * important as there are some rules with equal specificity that rely on order
8 * as a tiebreaker. These are marked with OVERRIDE.
9 */
10
6 /* Default state **************************************************************/ 11 /* Default state **************************************************************/
7 12
8 button:not(.custom-appearance):not(.link-button), 13 button:not(.custom-appearance):not(.link-button),
9 input[type='button']:not(.custom-appearance):not(.link-button), 14 input[type='button']:not(.custom-appearance):not(.link-button),
10 input[type='submit']:not(.custom-appearance):not(.link-button), 15 input[type='submit']:not(.custom-appearance):not(.link-button),
11 select { 16 select,
17 input[type='checkbox'],
18 input[type='radio'] {
19 -webkit-appearance: none;
12 -webkit-user-select: none; 20 -webkit-user-select: none;
21 background-image: -webkit-linear-gradient(#ededed, #ededed 38%, #dedede);
13 border-radius: 2px; 22 border-radius: 2px;
14 border: 1px solid rgba(0, 0, 0, 0.25); 23 border: 1px solid rgba(0, 0, 0, 0.25);
15 box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08), 24 box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08),
16 inset 0 1px 2px rgba(255, 255, 255, 0.75); 25 inset 0 1px 2px rgba(255, 255, 255, 0.75);
17 color: #444; 26 color: #444;
18 font: inherit; 27 font: inherit;
28 margin: 0 1px 0 0;
29 text-shadow: 0 1px 0 rgb(240, 240, 240);
30 }
31
32 button:not(.custom-appearance):not(.link-button),
33 input[type='button']:not(.custom-appearance):not(.link-button),
34 input[type='submit']:not(.custom-appearance):not(.link-button),
35 select {
19 height: 2em; 36 height: 2em;
20 margin: 0 1px 0 0;
21 min-width: 4em; 37 min-width: 4em;
22 text-shadow: 0 1px 0 rgb(240, 240, 240);
23 } 38 }
24 39
25 button:not(.custom-appearance):not(.link-button), 40 button:not(.custom-appearance):not(.link-button),
26 input[type='button']:not(.custom-appearance):not(.link-button), 41 input[type='button']:not(.custom-appearance):not(.link-button),
27 input[type='submit']:not(.custom-appearance):not(.link-button) { 42 input[type='submit']:not(.custom-appearance):not(.link-button) {
28 -webkit-padding-end: 10px; 43 -webkit-padding-end: 10px;
29 -webkit-padding-start: 10px; 44 -webkit-padding-start: 10px;
30 background-image:
31 -webkit-gradient(linear, left top, left bottom,
32 color-stop(0, rgb(237, 237, 237)),
33 color-stop(0.38, rgb(237, 237, 237)),
34 color-stop(1, rgb(222, 222, 222)));
35 } 45 }
36 46
37 select { 47 select {
38 -webkit-appearance: none; 48 -webkit-appearance: none;
39 -webkit-padding-end: 20px; 49 -webkit-padding-end: 20px;
40 -webkit-padding-start: 6px; 50 -webkit-padding-start: 6px;
51 /* OVERRIDE */
41 background-image: url('../images/select.png'), 52 background-image: url('../images/select.png'),
42 -webkit-gradient(linear, left top, left bottom, 53 -webkit-linear-gradient(#ededed, #ededed 38%, #dedede);
43 color-stop(0, rgb(237, 237, 237)),
44 color-stop(0.38, rgb(237, 237, 237)),
45 color-stop(1, rgb(222, 222, 222)));
46 background-position: right center; 54 background-position: right center;
47 background-repeat: no-repeat; 55 background-repeat: no-repeat;
48 overflow: hidden; 56 overflow: hidden;
49 text-align: left; 57 text-align: left;
50 text-overflow: ellipsis; 58 text-overflow: ellipsis;
51 white-space: nowrap; 59 white-space: nowrap;
52 } 60 }
53 61
54 html[dir='rtl'] select { 62 html[dir='rtl'] select {
55 background-position: center left; 63 background-position: center left;
56 } 64 }
57 65
66 input[type='checkbox'] {
67 bottom: 2px;
68 height: 13px;
69 position: relative;
70 vertical-align: middle;
71 width: 13px;
72 }
73
74 input[type='radio'] {
75 /* OVERRIDE */
76 border-radius: 100%;
77 height: 15px;
78 position: relative;
79 width: 15px;
80 }
81
82 /* Checked ********************************************************************/
83
84 input[type='checkbox']:checked::before {
85 -webkit-user-select: none;
86 background-image: url('../images/check.png');
87 background-size: 100% 100%;
88 content: '';
89 display: block;
90 height: 100%;
91 width: 100%;
92 }
93
94 html[dir='rtl'] input[type='checkbox']:checked::before {
95 -webkit-transform: scaleX(-1);
96 }
97
98 input[type='radio']:checked::before {
99 background-color: #666;
100 border-radius: 100%;
101 bottom: 25%;
102 content: '';
103 display: block;
104 left: 25%;
105 position: absolute;
106 right: 25%;
107 top: 25%;
108 }
109
58 /* Hover **********************************************************************/ 110 /* Hover **********************************************************************/
59 111
60 button:not(.custom-appearance):not(.link-button):enabled:hover, 112 button:not(.custom-appearance):not(.link-button):enabled:hover,
61 input[type='button']:not(.custom-appearance):not(.link-button):enabled:hover, 113 input[type='button']:not(.custom-appearance):not(.link-button):enabled:hover,
62 input[type='submit']:not(.custom-appearance):not(.link-button):enabled:hover {
63 background-image: -webkit-gradient(linear, left top, left bottom,
64 color-stop(0, rgb(240, 240, 240)),
65 color-stop(0.38, rgb(240, 240, 240)),
66 color-stop(1, rgb(224, 224, 224)));
67 }
68
69 select:enabled:hover {
70 background-image: url('../images/select.png'),
71 -webkit-gradient(linear, left top, left bottom,
72 color-stop(0, rgb(237, 237, 237)),
73 color-stop(0.38, rgb(237, 237, 237)),
74 color-stop(1, rgb(222, 222, 222)));
75 }
76
77 button:not(.custom-appearance):not(.link-button):enabled:hover,
78 input[type='button']:not(.custom-appearance):not(.link-button):enabled:hover,
79 input[type='submit']:not(.custom-appearance):not(.link-button):enabled:hover, 114 input[type='submit']:not(.custom-appearance):not(.link-button):enabled:hover,
80 select:enabled:hover { 115 select:enabled:hover,
116 input[type='checkbox']:enabled:hover,
117 input[type='radio']:enabled:hover {
118 background-image: -webkit-linear-gradient(#f0f0f0, #f0f0f0 38%, #e0e0e0);
81 border-color: rgba(0, 0, 0, 0.3); 119 border-color: rgba(0, 0, 0, 0.3);
82 box-shadow: 0 1px 0 rgba(0, 0, 0, 0.12), 120 box-shadow: 0 1px 0 rgba(0, 0, 0, 0.12),
83 inset 0 1px 2px rgba(255, 255, 255, 0.95); 121 inset 0 1px 2px rgba(255, 255, 255, 0.95);
84 color: black; 122 color: black;
85 } 123 }
86 124
125 select:enabled:hover {
126 /* OVERRIDE */
127 background-image: url('../images/select.png'),
128 -webkit-linear-gradient(#f0f0f0, #f0f0f0 38%, #e0e0e0);
129 }
130
87 /* Active *********************************************************************/ 131 /* Active *********************************************************************/
88 132
89 button:not(.custom-appearance):not(.link-button):enabled:active, 133 button:not(.custom-appearance):not(.link-button):enabled:active,
90 input[type='button']:not(.custom-appearance):not(.link-button):enabled:active, 134 input[type='button']:not(.custom-appearance):not(.link-button):enabled:active,
91 input[type='submit']:not(.custom-appearance):not(.link-button):enabled:active { 135 input[type='submit']:not(.custom-appearance):not(.link-button):enabled:active,
92 background-image: -webkit-gradient(linear, left top, left bottom, 136 select:enabled:active,
93 color-stop(0, rgb(231, 231, 231)), 137 input[type='checkbox']:enabled:active,
94 color-stop(0.38, rgb(231, 231, 231)), 138 input[type='radio']:enabled:active {
95 color-stop(1, rgb(215, 215, 215))); 139 background-image: -webkit-linear-gradient(#e7e7e7, #e7e7e7 38%, #d7d7d7);
140 box-shadow: none;
141 text-shadow: none;
96 } 142 }
97 143
98 select:enabled:active { 144 select:enabled:active {
145 /* OVERRIDE */
99 background-image: url('../images/select.png'), 146 background-image: url('../images/select.png'),
100 -webkit-gradient(linear, left top, left bottom, 147 -webkit-linear-gradient(#e7e7e7, #e7e7e7 38%, #d7d7d7);
101 color-stop(0, rgb(231, 231, 231)),
102 color-stop(0.38, rgb(231, 231, 231)),
103 color-stop(1, rgb(215, 215, 215)));
104 }
105
106 button:not(.custom-appearance):not(.link-button):enabled:active,
107 input[type='button']:not(.custom-appearance):not(.link-button):enabled:active,
108 input[type='submit']:not(.custom-appearance):not(.link-button):enabled:active,
109 select:enabled:active {
110 box-shadow: none;
111 text-shadow: none;
112 } 148 }
113 149
114 /* Disabled *******************************************************************/ 150 /* Disabled *******************************************************************/
115 151
116 button:not(.custom-appearance):not(.link-button):disabled, 152 button:not(.custom-appearance):not(.link-button):disabled,
117 input[type='button']:not(.custom-appearance):not(.link-button):disabled, 153 input[type='button']:not(.custom-appearance):not(.link-button):disabled,
118 input[type='submit']:not(.custom-appearance):not(.link-button):disabled, 154 input[type='submit']:not(.custom-appearance):not(.link-button):disabled,
119 select:disabled { 155 select:disabled {
120 border-color: rgba(0, 0, 0, 0.2); 156 border-color: rgba(0, 0, 0, 0.2);
121 color: #999; 157 color: #999;
122 } 158 }
123 159
124 select:disabled { 160 select:disabled {
125 background-image: url('../images/disabled_select.png'), 161 background-image: url('../images/disabled_select.png'),
126 -webkit-gradient(linear, left top, left bottom, 162 -webkit-linear-gradient(#ededed, #ededed 38%, #dedede);
127 color-stop(0, rgb(237, 237, 237)), 163 }
128 color-stop(0.38, rgb(237, 237, 237)), 164
129 color-stop(1, rgb(222, 222, 222))); 165 input[type='checkbox']:disabled,
166 input[type='radio']:disabled {
167 opacity: .75;
130 } 168 }
131 169
132 /* Focus **********************************************************************/ 170 /* Focus **********************************************************************/
133 171
134 button:not(.custom-appearance):not(.link-button):focus, 172 button:not(.custom-appearance):not(.link-button):focus,
135 input[type='submit']:not(.custom-appearance):focus, 173 input[type='submit']:not(.custom-appearance):focus,
136 input[type='text']:not(.custom-appearance):focus, 174 input[type='text']:focus,
175 input[type='checkbox']:focus,
176 input[type='radio']:focus,
137 select:focus { 177 select:focus {
138 -webkit-transition: border-color 200ms; 178 -webkit-transition: border-color 200ms;
139 /* We use border color because it follows the border radius (unlike outline). 179 /* We use border color because it follows the border radius (unlike outline).
140 * This is particularly noticeable on mac. */ 180 * This is particularly noticeable on mac. */
141 border-color: rgb(77, 144, 254); 181 border-color: rgb(77, 144, 254);
142 outline: none; 182 outline: none;
143 } 183 }
144 184
145 /* Search boxes use an outline because it follows the contours of the box. */ 185 /* Search boxes use an outline because it follows the contours of the box. */
146 input[type='search']:not(.custom-appearance):focus { 186 input[type='search']:not(.custom-appearance):focus {
(...skipping 22 matching lines...) Expand all
169 .link-button:active { 209 .link-button:active {
170 color: rgb(5, 37, 119); 210 color: rgb(5, 37, 119);
171 text-decoration: underline; 211 text-decoration: underline;
172 } 212 }
173 213
174 .link-button[disabled] { 214 .link-button[disabled] {
175 color: #888; 215 color: #888;
176 cursor: default; 216 cursor: default;
177 text-decoration: none; 217 text-decoration: none;
178 } 218 }
219
220 /* Checkbox/radio helpers ******************************************************
221 *
222 * .checkbox and .radio classes wrap labels. Checkboxes and radios should use
223 * these classes with the markup structure:
224 *
225 * <div class="checkbox">
226 * <label>
227 * <input type="checkbox"></input>
228 * <span>
229 * </label>
230 * </div>
231 */
232
233 .checkbox,
234 .radio {
235 margin: 0.45em 0;
236 }
237
238 .checkbox label,
239 .radio label {
240 color: #444;
241 /* Don't expand horizontally: <http://crbug.com/112091>. */
242 display: -webkit-inline-box;
243 }
244
245 .checkbox label input ~ span,
246 .radio label input ~ span {
247 -webkit-margin-start: 0.4em;
248 /* Make sure long spans wrap at the same horizontal position they start. */
249 display: block;
250 }
251
252 .checkbox label:hover,
253 .radio label:hover {
254 color: black;
255 }
256
257 label > input[type=checkbox]:disabled ~ span,
258 label > input[type=radio]:disabled ~ span {
259 color: #999;
260 }
261
262 /* Text inputs ****************************************************************/
263 /* TODO(estade): add more types here? */
264 input[type='password'],
265 input[type='search'],
266 input[type='text'],
267 input[type='url'],
268 input:not([type]) {
269 border: 1px solid #bfbfbf;
270 border-radius: 2px;
271 box-sizing: border-box;
272 font: inherit;
273 height: 2em;
274 margin: 0;
275 padding: 3px;
276 }
277
278 input[type='search'] {
279 /* NOTE: Keep a relatively high min-width for this so we don't obscure the end
csilv 2012/03/07 19:52:09 Please add: -webkit-appearance: textfield;
Evan Stade 2012/03/08 00:52:08 Done.
280 * of the default text in relatively spacious languages (i.e. German). */
281 min-width: 160px;
282 }
283
284 input[type='text']:disabled {
285 color: #888;
286 }
OLDNEW
« no previous file with comments | « chrome/browser/resources/shared/css/chrome_shared2.css ('k') | chrome/browser/resources/shared/images/check.png » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698