chromium/ui/webui/resources/css/widgets.css

/* Copyright 2012 The Chromium Authors
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file. */

/* This file defines styles for form controls. The order of rule blocks is
 * important as there are some rules with equal specificity that rely on order
 * as a tiebreaker. These are marked with OVERRIDE. */

@import url(action_link.css);

/* Default state **************************************************************/

:-webkit-any(button,
             input[type='button'],
             input[type='submit']):not(.custom-appearance),
select,
input[type='checkbox'],
input[type='radio'] {
  -webkit-appearance: none;
  background-image: linear-gradient(#ededed, #ededed 38%, #dedede);
  border: 1px solid rgba(0, 0, 0, 0.25);
  border-radius: 2px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08),
      inset 0 1px 2px rgba(255, 255, 255, 0.75);
  color: #444;
  font: inherit;
  margin: 0 1px 0 0;
  outline: none;
  text-shadow: 0 1px 0 rgb(240, 240, 240);
  user-select: none;
}

:-webkit-any(button,
             input[type='button'],
             input[type='submit']):not(.custom-appearance),
select {
  min-height: 2em;
  min-width: 4em;
  padding-bottom: 1px;
<if expr="is_win or is_macosx">
  /* The following platform-specific rule is necessary to get adjacent
   * buttons, text inputs, and so forth to align on their borders while also
   * aligning on the text's baselines. */
  padding-bottom: 2px;
</if>
  padding-top: 1px;
}

:-webkit-any(button,
             input[type='button'],
             input[type='submit']):not(.custom-appearance) {
  padding-inline-end: 10px;
  padding-inline-start: 10px;
}

select {
  -webkit-appearance: none;
  /* OVERRIDE */
  background-image:
      image-set(
          url(../images/select.png) 1x,
          url(../images/2x/select.png) 2x),
      linear-gradient(#ededed, #ededed 38%, #dedede);
  background-position: right center;
  background-repeat: no-repeat;
  padding-inline-end: 24px;
  padding-inline-start: 10px;
}

html[dir='rtl'] select {
  background-position: center left;
}

input[type='checkbox'] {
  height: 13px;
  position: relative;
  vertical-align: middle;
  width: 13px;
}

input[type='radio'] {
  /* OVERRIDE */
  border-radius: 100%;
  height: 15px;
  position: relative;
  vertical-align: middle;
  width: 15px;
}

/* TODO(estade): add more types here? */
input[type='number'],
input[type='password'],
input[type='search'],
input[type='text'],
input[type='url'],
input:not([type]),
textarea {
  border: 1px solid #bfbfbf;
  border-radius: 2px;
  box-sizing: border-box;
  color: #444;
  font: inherit;
  margin: 0;
  /* Use min-height to accommodate addditional padding for touch as needed. */
  min-height: 2em;
  outline: none;
  padding: 3px;
<if expr="is_win or is_macosx or is_ios">
  /* For better alignment between adjacent buttons and inputs. */
  padding-bottom: 4px;
</if>
}

input[type='search'] {
  -webkit-appearance: textfield;
  /* NOTE: Keep a relatively high min-width for this so we don't obscure the end
   * of the default text in relatively spacious languages (i.e. German). */
  min-width: 160px;
}

/* Checked ********************************************************************/

input[type='checkbox']:checked::before {
  background-image: image-set(
      url(../images/check.png) 1x,
      url(../images/2x/check.png) 2x);
  background-size: 100% 100%;
  content: '';
  display: block;
  height: 100%;
  user-select: none;
  width: 100%;
}

@media (forced-colors: active) {
  input[type='checkbox'] {
    appearance: auto;
  }

  input[type='checkbox']:checked::before {
    display: none;
  }
}

input[type='radio']:checked::before {
  background-color: #666;
  border-radius: 100%;
  bottom: 3px;
  content: '';
  display: block;
  left: 3px;
  position: absolute;
  right: 3px;
  top: 3px;
}

<if expr="not is_ios">
/* Hover **********************************************************************/

:enabled:hover:-webkit-any(
    select,
    input[type='checkbox'],
    input[type='radio'],
    :-webkit-any(
        button,
        input[type='button'],
        input[type='submit']):not(.custom-appearance)) {
  background-image: linear-gradient(#f0f0f0, #f0f0f0 38%, #e0e0e0);
  border-color: rgba(0, 0, 0, 0.3);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.12),
      inset 0 1px 2px rgba(255, 255, 255, 0.95);
  color: black;
}

:enabled:hover:-webkit-any(select) {
  /* OVERRIDE */
  background-image:
      image-set(
          url(../images/select.png) 1x,
          url(../images/2x/select.png) 2x),
      linear-gradient(#f0f0f0, #f0f0f0 38%, #e0e0e0);
}
</if>

/* Active *********************************************************************/

:enabled:active:-webkit-any(
    select,
    input[type='checkbox'],
    input[type='radio'],
    :-webkit-any(
        button,
        input[type='button'],
        input[type='submit']):not(.custom-appearance)) {
  background-image: linear-gradient(#e7e7e7, #e7e7e7 38%, #d7d7d7);
  box-shadow: none;
  text-shadow: none;
}

:enabled:active:-webkit-any(select) {
  /* OVERRIDE */
  background-image: url(../images/select.png),
      linear-gradient(#e7e7e7, #e7e7e7 38%, #d7d7d7);
}

/* Disabled *******************************************************************/

:disabled:-webkit-any(
    button,
    input[type='button'],
    input[type='submit']):not(.custom-appearance),
select:disabled {
  background-image: linear-gradient(#f1f1f1, #f1f1f1 38%, #e6e6e6);
  border-color: rgba(80, 80, 80, 0.2);
  box-shadow: 0 1px 0 rgba(80, 80, 80, 0.08),
      inset 0 1px 2px rgba(255, 255, 255, 0.75);
  color: #aaa;
}

select:disabled {
  /* OVERRIDE */
  background-image:
      image-set(
          url(../images/disabled_select.png) 1x,
          url(../images/2x/disabled_select.png) 2x),
      linear-gradient(#f1f1f1, #f1f1f1 38%, #e6e6e6);
}

input:disabled:-webkit-any([type='checkbox'],
                           [type='radio']) {
  opacity: .75;
}

input:disabled:-webkit-any([type='password'],
                           [type='search'],
                           [type='text'],
                           [type='url'],
                           :not([type])) {
  color: #999;
}

/* Focus **********************************************************************/

:enabled:focus:-webkit-any(
    select,
    input[type='checkbox'],
    input[type='number'],
    input[type='password'],
    input[type='radio'],
    input[type='search'],
    input[type='text'],
    input[type='url'],
    input:not([type]),
    :-webkit-any(
         button,
         input[type='button'],
         input[type='submit']):not(.custom-appearance)) {
  /* We use border color because it follows the border radius (unlike outline).
   * This is particularly noticeable on mac. */
  border-color: rgb(77, 144, 254);
  outline: none;
  /* OVERRIDE */
  transition: border-color 200ms;
}

/* Checkbox/radio helpers ******************************************************
 *
 * .checkbox and .radio classes wrap labels. Checkboxes and radios should use
 * these classes with the markup structure:
 *
 *   <div class="checkbox">
 *     <label>
 *       <input type="checkbox">
 *       <span>
 *     </label>
 *   </div>
 */

:-webkit-any(.checkbox, .radio) label {
  /* Don't expand horizontally: <http://crbug.com/112091>. */
  align-items: center;
  display: inline-flex;
  padding-bottom: 7px;
  padding-top: 7px;
  user-select: none;
}

:-webkit-any(.checkbox, .radio) label input {
  flex-shrink: 0;
}

:-webkit-any(.checkbox, .radio) label input ~ span {
  /* Make sure long spans wrap at the same horizontal position they start. */
  display: block;
  margin-inline-start: 0.6em;
}

:-webkit-any(.checkbox, .radio) label:hover {
  color: black;
}

label > input:disabled:-webkit-any([type='checkbox'], [type='radio']) ~ span {
  color: #999;
}

extensionview {
  display: inline-block;
  height: 300px;
  width: 300px;
}