_mixins.general.scss 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. // =============================================================================
  2. // Mixins
  3. // =============================================================================
  4. // Please note that the mixins partial shouldn't include any classes. This is so
  5. // it can be included in any file without accidentally producing output
  6. // Turns on font-smoothing when used. Use sparingly.
  7. @mixin font-smoothing {
  8. -webkit-font-smoothing: antialiased;
  9. -moz-osx-font-smoothing: grayscale;
  10. }
  11. @mixin clearfix() {
  12. &:before,
  13. &:after {
  14. content: ' ';
  15. display: table;
  16. }
  17. &:after {
  18. clear: both;
  19. }
  20. }
  21. @mixin unlist() {
  22. margin-top: 0;
  23. margin-bottom: 0;
  24. padding-left: 0;
  25. list-style-type: none;
  26. font-style: normal;
  27. li {
  28. list-style-type: none;
  29. font-style: normal;
  30. }
  31. }
  32. // remove list styles, but only for the immediate element -
  33. // allow nested lists inside it to keep the default style
  34. @mixin unlistimmediate() {
  35. margin-top: 0;
  36. margin-bottom: 0;
  37. padding-left: 0;
  38. list-style-type: none;
  39. font-style: normal;
  40. > li {
  41. list-style-type: none;
  42. font-style: normal;
  43. }
  44. }
  45. @mixin transition($transition...) {
  46. body.ready & {
  47. transition: $transition;
  48. }
  49. }
  50. @mixin visuallyhidden {
  51. border: 0;
  52. clip: rect(0 0 0 0);
  53. height: 1px;
  54. margin: -1px;
  55. overflow: hidden;
  56. padding: 0;
  57. position: absolute;
  58. width: 1px;
  59. &:active,
  60. &:focus {
  61. clip: auto;
  62. height: auto;
  63. margin: 0;
  64. overflow: visible;
  65. position: static;
  66. width: auto;
  67. }
  68. }
  69. @mixin visuallyvisible {
  70. clip: auto;
  71. height: auto;
  72. width: auto;
  73. margin: initial;
  74. overflow: visible;
  75. position: initial;
  76. }
  77. @mixin icon () {
  78. @include font-smoothing;
  79. font-family: 'wagtail';
  80. font-style: normal;
  81. font-weight: normal;
  82. font-variant: normal;
  83. text-transform: none;
  84. speak: none;
  85. text-decoration: none;
  86. width: 1.3em;
  87. line-height: 1em;
  88. text-align: left;
  89. vertical-align: middle;
  90. margin-right: 0.2em;
  91. }
  92. @mixin svg-icon ($size: 1.5em, $position: text-top) {
  93. width: $size;
  94. height: $size;
  95. vertical-align: $position;
  96. }
  97. // Applies given rules on hover, except for touch screens.
  98. // Relies on feature detection to add a no-touch class on the html element.
  99. @mixin hover {
  100. .no-touch &:hover {
  101. @content;
  102. }
  103. }
  104. // Where included, show the focus outline within focusable items instead of around them.
  105. // This is useful when focusable items are tightly packed and there is no space in-between.
  106. @mixin show-focus-outline-inside {
  107. outline-offset: -1 * $focus-outline-width;
  108. }