| OLD | NEW |
| 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='search']:focus { |
| 176 input[type='checkbox']:focus, |
| 177 input[type='radio']:focus, |
| 137 select:focus { | 178 select:focus { |
| 138 -webkit-transition: border-color 200ms; | 179 -webkit-transition: border-color 200ms; |
| 139 /* We use border color because it follows the border radius (unlike outline). | 180 /* We use border color because it follows the border radius (unlike outline). |
| 140 * This is particularly noticeable on mac. */ | 181 * This is particularly noticeable on mac. */ |
| 141 border-color: rgb(77, 144, 254); | 182 border-color: rgb(77, 144, 254); |
| 142 outline: none; | 183 outline: none; |
| 143 } | 184 } |
| 144 | 185 |
| 145 /* Search boxes use an outline because it follows the contours of the box. */ | |
| 146 input[type='search']:not(.custom-appearance):focus { | |
| 147 outline-color: rgb(77, 144, 254); | |
| 148 } | |
| 149 | |
| 150 /* Link buttons ***************************************************************/ | 186 /* Link buttons ***************************************************************/ |
| 151 | 187 |
| 152 .link-button { | 188 .link-button { |
| 153 -webkit-box-shadow: none; | 189 -webkit-box-shadow: none; |
| 154 background: transparent none; | 190 background: transparent none; |
| 155 border: none; | 191 border: none; |
| 156 color: rgb(17, 85, 204); | 192 color: rgb(17, 85, 204); |
| 157 cursor: pointer; | 193 cursor: pointer; |
| 158 /* Input elements have -webkit-small-control which can override the body font. | 194 /* Input elements have -webkit-small-control which can override the body font. |
| 159 * Resolve this by using 'inherit'. */ | 195 * Resolve this by using 'inherit'. */ |
| 160 font: inherit; | 196 font: inherit; |
| 161 margin: 0; | 197 margin: 0; |
| 162 padding: 0 4px; | 198 padding: 0 4px; |
| 163 } | 199 } |
| 164 | 200 |
| 165 .link-button:hover { | 201 .link-button:hover { |
| 166 text-decoration: underline; | 202 text-decoration: underline; |
| 167 } | 203 } |
| 168 | 204 |
| 169 .link-button:active { | 205 .link-button:active { |
| 170 color: rgb(5, 37, 119); | 206 color: rgb(5, 37, 119); |
| 171 text-decoration: underline; | 207 text-decoration: underline; |
| 172 } | 208 } |
| 173 | 209 |
| 174 .link-button[disabled] { | 210 .link-button[disabled] { |
| 175 color: #888; | 211 color: #888; |
| 176 cursor: default; | 212 cursor: default; |
| 177 text-decoration: none; | 213 text-decoration: none; |
| 178 } | 214 } |
| 215 |
| 216 /* Checkbox/radio helpers ****************************************************** |
| 217 * |
| 218 * .checkbox and .radio classes wrap labels. Checkboxes and radios should use |
| 219 * these classes with the markup structure: |
| 220 * |
| 221 * <div class="checkbox"> |
| 222 * <label> |
| 223 * <input type="checkbox"></input> |
| 224 * <span> |
| 225 * </label> |
| 226 * </div> |
| 227 */ |
| 228 |
| 229 .checkbox, |
| 230 .radio { |
| 231 margin: 0.45em 0; |
| 232 } |
| 233 |
| 234 .checkbox label, |
| 235 .radio label { |
| 236 color: #444; |
| 237 /* Don't expand horizontally: <http://crbug.com/112091>. */ |
| 238 display: -webkit-inline-box; |
| 239 } |
| 240 |
| 241 .checkbox label input ~ span, |
| 242 .radio label input ~ span { |
| 243 -webkit-margin-start: 0.4em; |
| 244 /* Make sure long spans wrap at the same horizontal position they start. */ |
| 245 display: block; |
| 246 } |
| 247 |
| 248 .checkbox label:hover, |
| 249 .radio label:hover { |
| 250 color: black; |
| 251 } |
| 252 |
| 253 label > input[type=checkbox]:disabled ~ span, |
| 254 label > input[type=radio]:disabled ~ span { |
| 255 color: #999; |
| 256 } |
| 257 |
| 258 /* Text inputs ****************************************************************/ |
| 259 /* TODO(estade): add more types here? */ |
| 260 input[type='password'], |
| 261 input[type='search'], |
| 262 input[type='text'], |
| 263 input[type='url'], |
| 264 input:not([type]) { |
| 265 border: 1px solid #bfbfbf; |
| 266 border-radius: 2px; |
| 267 box-sizing: border-box; |
| 268 font: inherit; |
| 269 height: 2em; |
| 270 margin: 0; |
| 271 padding: 3px; |
| 272 } |
| 273 |
| 274 input[type='search'] { |
| 275 -webkit-appearance: textfield; |
| 276 /* NOTE: Keep a relatively high min-width for this so we don't obscure the end |
| 277 * of the default text in relatively spacious languages (i.e. German). */ |
| 278 min-width: 160px; |
| 279 } |
| 280 |
| 281 input[type='text']:disabled { |
| 282 color: #888; |
| 283 } |
| OLD | NEW |