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 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. // Button variants
  2. //
  3. // Easily pump out default styles, as well as :hover, :focus, :active,
  4. // and disabled options for all buttons
  5. @mixin button-variant($background, $border, $hover-background: darken($background, 7.5%), $hover-border: darken($border, 10%), $active-background: darken($background, 10%), $active-border: darken($border, 12.5%)) {
  6. color: color-yiq($background);
  7. @include gradient-bg($background);
  8. border-color: $border;
  9. @include box-shadow($btn-box-shadow);
  10. @include hover() {
  11. color: color-yiq($hover-background);
  12. @include gradient-bg($hover-background);
  13. border-color: $hover-border;
  14. }
  15. &:focus,
  16. &.focus {
  17. color: color-yiq($hover-background);
  18. @include gradient-bg($hover-background);
  19. border-color: $hover-border;
  20. @if $enable-shadows {
  21. @include box-shadow($btn-box-shadow, 0 0 0 $btn-focus-width rgba(mix(color-yiq($background), $border, 15%), .5));
  22. } @else {
  23. // Avoid using mixin so we can pass custom focus shadow properly
  24. box-shadow: 0 0 0 $btn-focus-width rgba(mix(color-yiq($background), $border, 15%), .5);
  25. }
  26. }
  27. // Disabled comes first so active can properly restyle
  28. &.disabled,
  29. &:disabled {
  30. color: color-yiq($background);
  31. background-color: $background;
  32. border-color: $border;
  33. // Remove CSS gradients if they're enabled
  34. @if $enable-gradients {
  35. background-image: none;
  36. }
  37. }
  38. &:not(:disabled):not(.disabled):active,
  39. &:not(:disabled):not(.disabled).active,
  40. .show > &.dropdown-toggle {
  41. color: color-yiq($active-background);
  42. background-color: $active-background;
  43. @if $enable-gradients {
  44. background-image: none; // Remove the gradient for the pressed/active state
  45. }
  46. border-color: $active-border;
  47. &:focus {
  48. @if $enable-shadows and $btn-active-box-shadow != none {
  49. @include box-shadow($btn-active-box-shadow, 0 0 0 $btn-focus-width rgba(mix(color-yiq($background), $border, 15%), .5));
  50. } @else {
  51. // Avoid using mixin so we can pass custom focus shadow properly
  52. box-shadow: 0 0 0 $btn-focus-width rgba(mix(color-yiq($background), $border, 15%), .5);
  53. }
  54. }
  55. }
  56. }
  57. @mixin button-outline-variant($color, $color-hover: color-yiq($color), $active-background: $color, $active-border: $color) {
  58. color: $color;
  59. border-color: $color;
  60. @include hover() {
  61. color: $color-hover;
  62. background-color: $active-background;
  63. border-color: $active-border;
  64. }
  65. &:focus,
  66. &.focus {
  67. box-shadow: 0 0 0 $btn-focus-width rgba($color, .5);
  68. }
  69. &.disabled,
  70. &:disabled {
  71. color: $color;
  72. background-color: transparent;
  73. }
  74. &:not(:disabled):not(.disabled):active,
  75. &:not(:disabled):not(.disabled).active,
  76. .show > &.dropdown-toggle {
  77. color: color-yiq($active-background);
  78. background-color: $active-background;
  79. border-color: $active-border;
  80. &:focus {
  81. @if $enable-shadows and $btn-active-box-shadow != none {
  82. @include box-shadow($btn-active-box-shadow, 0 0 0 $btn-focus-width rgba($color, .5));
  83. } @else {
  84. // Avoid using mixin so we can pass custom focus shadow properly
  85. box-shadow: 0 0 0 $btn-focus-width rgba($color, .5);
  86. }
  87. }
  88. }
  89. }
  90. // Button sizes
  91. @mixin button-size($padding-y, $padding-x, $font-size, $line-height, $border-radius) {
  92. padding: $padding-y $padding-x;
  93. @include font-size($font-size);
  94. line-height: $line-height;
  95. // Manually declare to provide an override to the browser default
  96. @include border-radius($border-radius, 0);
  97. }