static/less/buttons.less
author stetrabby <info@trabucchi.de>
Fri, 20 Dec 2013 22:30:44 +0100
changeset 53 3416f82943ea
permissions -rwxr-xr-x
less initial added
info@53
     1
//
info@53
     2
// Buttons
info@53
     3
// --------------------------------------------------
info@53
     4
info@53
     5
info@53
     6
// Base styles
info@53
     7
// --------------------------------------------------
info@53
     8
info@53
     9
.btn {
info@53
    10
  display: inline-block;
info@53
    11
  margin-bottom: 0; // For input.btn
info@53
    12
  font-weight: @btn-font-weight;
info@53
    13
  text-align: center;
info@53
    14
  vertical-align: middle;
info@53
    15
  cursor: pointer;
info@53
    16
  background-image: none; // Reset unusual Firefox-on-Android default style; see https://github.com/necolas/normalize.css/issues/214
info@53
    17
  border: 1px solid transparent;
info@53
    18
  white-space: nowrap;
info@53
    19
  .button-size(@padding-base-vertical; @padding-base-horizontal; @font-size-base; @line-height-base; @border-radius-base);
info@53
    20
  .user-select(none);
info@53
    21
info@53
    22
  &:focus {
info@53
    23
    .tab-focus();
info@53
    24
  }
info@53
    25
info@53
    26
  &:hover,
info@53
    27
  &:focus {
info@53
    28
    color: @btn-default-color;
info@53
    29
    text-decoration: none;
info@53
    30
  }
info@53
    31
info@53
    32
  &:active,
info@53
    33
  &.active {
info@53
    34
    outline: 0;
info@53
    35
    background-image: none;
info@53
    36
    .box-shadow(inset 0 3px 5px rgba(0,0,0,.125));
info@53
    37
  }
info@53
    38
info@53
    39
  &.disabled,
info@53
    40
  &[disabled],
info@53
    41
  fieldset[disabled] & {
info@53
    42
    cursor: not-allowed;
info@53
    43
    pointer-events: none; // Future-proof disabling of clicks
info@53
    44
    .opacity(.65);
info@53
    45
    .box-shadow(none);
info@53
    46
  }
info@53
    47
}
info@53
    48
info@53
    49
info@53
    50
// Alternate buttons
info@53
    51
// --------------------------------------------------
info@53
    52
info@53
    53
.btn-default {
info@53
    54
  .button-variant(@btn-default-color; @btn-default-bg; @btn-default-border);
info@53
    55
}
info@53
    56
.btn-primary {
info@53
    57
  .button-variant(@btn-primary-color; @btn-primary-bg; @btn-primary-border);
info@53
    58
}
info@53
    59
// Warning appears as orange
info@53
    60
.btn-warning {
info@53
    61
  .button-variant(@btn-warning-color; @btn-warning-bg; @btn-warning-border);
info@53
    62
}
info@53
    63
// Danger and error appear as red
info@53
    64
.btn-danger {
info@53
    65
  .button-variant(@btn-danger-color; @btn-danger-bg; @btn-danger-border);
info@53
    66
}
info@53
    67
// Success appears as green
info@53
    68
.btn-success {
info@53
    69
  .button-variant(@btn-success-color; @btn-success-bg; @btn-success-border);
info@53
    70
}
info@53
    71
// Info appears as blue-green
info@53
    72
.btn-info {
info@53
    73
  .button-variant(@btn-info-color; @btn-info-bg; @btn-info-border);
info@53
    74
}
info@53
    75
info@53
    76
info@53
    77
// Link buttons
info@53
    78
// -------------------------
info@53
    79
info@53
    80
// Make a button look and behave like a link
info@53
    81
.btn-link {
info@53
    82
  color: @link-color;
info@53
    83
  font-weight: normal;
info@53
    84
  cursor: pointer;
info@53
    85
  border-radius: 0;
info@53
    86
info@53
    87
  &,
info@53
    88
  &:active,
info@53
    89
  &[disabled],
info@53
    90
  fieldset[disabled] & {
info@53
    91
    background-color: transparent;
info@53
    92
    .box-shadow(none);
info@53
    93
  }
info@53
    94
  &,
info@53
    95
  &:hover,
info@53
    96
  &:focus,
info@53
    97
  &:active {
info@53
    98
    border-color: transparent;
info@53
    99
  }
info@53
   100
  &:hover,
info@53
   101
  &:focus {
info@53
   102
    color: @link-hover-color;
info@53
   103
    text-decoration: underline;
info@53
   104
    background-color: transparent;
info@53
   105
  }
info@53
   106
  &[disabled],
info@53
   107
  fieldset[disabled] & {
info@53
   108
    &:hover,
info@53
   109
    &:focus {
info@53
   110
      color: @btn-link-disabled-color;
info@53
   111
      text-decoration: none;
info@53
   112
    }
info@53
   113
  }
info@53
   114
}
info@53
   115
info@53
   116
info@53
   117
// Button Sizes
info@53
   118
// --------------------------------------------------
info@53
   119
info@53
   120
.btn-lg {
info@53
   121
  // line-height: ensure even-numbered height of button next to large input
info@53
   122
  .button-size(@padding-large-vertical; @padding-large-horizontal; @font-size-large; @line-height-large; @border-radius-large);
info@53
   123
}
info@53
   124
.btn-sm {
info@53
   125
  // line-height: ensure proper height of button next to small input
info@53
   126
  .button-size(@padding-small-vertical; @padding-small-horizontal; @font-size-small; @line-height-small; @border-radius-small);
info@53
   127
}
info@53
   128
.btn-xs {
info@53
   129
  .button-size(@padding-xs-vertical; @padding-xs-horizontal; @font-size-small; @line-height-small; @border-radius-small);
info@53
   130
}
info@53
   131
info@53
   132
info@53
   133
// Block button
info@53
   134
// --------------------------------------------------
info@53
   135
info@53
   136
.btn-block {
info@53
   137
  display: block;
info@53
   138
  width: 100%;
info@53
   139
  padding-left: 0;
info@53
   140
  padding-right: 0;
info@53
   141
}
info@53
   142
info@53
   143
// Vertically space out multiple block buttons
info@53
   144
.btn-block + .btn-block {
info@53
   145
  margin-top: 5px;
info@53
   146
}
info@53
   147
info@53
   148
// Specificity overrides
info@53
   149
input[type="submit"],
info@53
   150
input[type="reset"],
info@53
   151
input[type="button"] {
info@53
   152
  &.btn-block {
info@53
   153
    width: 100%;
info@53
   154
  }
info@53
   155
}
Impressum Datenschutzerklärung