Layout von Websiten mit Bootstrap und Foundation
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

_buttons.scss 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. // stylelint-disable selector-no-qualifying-type
  2. //
  3. // Base styles
  4. //
  5. .btn {
  6. display: inline-block;
  7. font-family: $btn-font-family;
  8. font-weight: $btn-font-weight;
  9. color: $body-color;
  10. text-align: center;
  11. text-decoration: if($link-decoration == none, null, none);
  12. white-space: $btn-white-space;
  13. vertical-align: middle;
  14. user-select: none;
  15. background-color: transparent;
  16. border: $btn-border-width solid transparent;
  17. @include button-size($btn-padding-y, $btn-padding-x, $btn-font-size, $btn-line-height, $btn-border-radius);
  18. @include transition($btn-transition);
  19. @include hover() {
  20. color: $body-color;
  21. text-decoration: none;
  22. }
  23. &:focus,
  24. &.focus {
  25. outline: 0;
  26. box-shadow: $btn-focus-box-shadow;
  27. }
  28. // Disabled comes first so active can properly restyle
  29. &.disabled,
  30. &:disabled {
  31. opacity: $btn-disabled-opacity;
  32. @include box-shadow(none);
  33. }
  34. &:not(:disabled):not(.disabled) {
  35. cursor: if($enable-pointer-cursor-for-buttons, pointer, null);
  36. &:active,
  37. &.active {
  38. @include box-shadow($btn-active-box-shadow);
  39. &:focus {
  40. @include box-shadow($btn-focus-box-shadow, $btn-active-box-shadow);
  41. }
  42. }
  43. }
  44. }
  45. // Future-proof disabling of clicks on `<a>` elements
  46. a.btn.disabled,
  47. fieldset:disabled a.btn {
  48. pointer-events: none;
  49. }
  50. //
  51. // Alternate buttons
  52. //
  53. @each $color, $value in $theme-colors {
  54. .btn-#{$color} {
  55. @include button-variant($value, $value);
  56. }
  57. }
  58. @each $color, $value in $theme-colors {
  59. .btn-outline-#{$color} {
  60. @include button-outline-variant($value);
  61. }
  62. }
  63. //
  64. // Link buttons
  65. //
  66. // Make a button look and behave like a link
  67. .btn-link {
  68. font-weight: $font-weight-normal;
  69. color: $link-color;
  70. text-decoration: $link-decoration;
  71. @include hover() {
  72. color: $link-hover-color;
  73. text-decoration: $link-hover-decoration;
  74. }
  75. &:focus,
  76. &.focus {
  77. text-decoration: $link-hover-decoration;
  78. }
  79. &:disabled,
  80. &.disabled {
  81. color: $btn-link-disabled-color;
  82. pointer-events: none;
  83. }
  84. // No need for an active state here
  85. }
  86. //
  87. // Button Sizes
  88. //
  89. .btn-lg {
  90. @include button-size($btn-padding-y-lg, $btn-padding-x-lg, $btn-font-size-lg, $btn-line-height-lg, $btn-border-radius-lg);
  91. }
  92. .btn-sm {
  93. @include button-size($btn-padding-y-sm, $btn-padding-x-sm, $btn-font-size-sm, $btn-line-height-sm, $btn-border-radius-sm);
  94. }
  95. //
  96. // Block button
  97. //
  98. .btn-block {
  99. display: block;
  100. width: 100%;
  101. // Vertically space out multiple block buttons
  102. + .btn-block {
  103. margin-top: $btn-block-spacing-y;
  104. }
  105. }
  106. // Specificity overrides
  107. input[type="submit"],
  108. input[type="reset"],
  109. input[type="button"] {
  110. &.btn-block {
  111. width: 100%;
  112. }
  113. }