暫無描述

_mixins-master.scss 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. // Rem output with px fallback
  2. @mixin font-size($sizeValue: 1) {
  3. font-size: ($sizeValue * 16) * 1px;
  4. font-size: $sizeValue * 1rem;
  5. }
  6. // Center block
  7. @mixin center-block {
  8. display: block;
  9. margin-left: auto;
  10. margin-right: auto;
  11. }
  12. // Clearfix
  13. @mixin clearfix() {
  14. content: "";
  15. display: table;
  16. table-layout: fixed;
  17. }
  18. // Clear after (not all clearfix need this also)
  19. @mixin clearfix-after() {
  20. clear: both;
  21. }
  22. // Column width with margin
  23. @mixin column-width($numberColumns: 3) {
  24. width: map-get($columns, $numberColumns) - (($columns__margin * ($numberColumns - 1)) / $numberColumns);
  25. }
  26. @mixin filter-duotone {
  27. &:before {
  28. background: $color__link;
  29. mix-blend-mode: screen;
  30. opacity: 0.1;
  31. z-index: 2;
  32. }
  33. &:after {
  34. background: $color__link;
  35. mix-blend-mode: multiply;
  36. opacity: .8;
  37. z-index: 3;
  38. /* Browsers supporting mix-blend-mode don't need opacity < 1 */
  39. @supports (mix-blend-mode: multiply) {
  40. opacity: 1;
  41. }
  42. }
  43. }
  44. @mixin filter-grayscale {
  45. position: relative;
  46. filter: grayscale(100%);
  47. z-index: 1;
  48. &:after {
  49. display: block;
  50. width: 100%;
  51. height: 100%;
  52. z-index: 10;
  53. }
  54. }
  55. @mixin post-section-dash {
  56. &:before {
  57. background: $color__text-light;
  58. content: "\020";
  59. display: block;
  60. height: 2px;
  61. margin: $size__spacing-unit 0;
  62. width: 1em;
  63. }
  64. &.has-text-align-center:before {
  65. margin-left: auto;
  66. margin-right: auto;
  67. }
  68. &.has-text-align-right:before {
  69. margin-left: auto;
  70. }
  71. }
  72. /* If we add the border using a regular CSS border, it won't look good on non-retina devices,
  73. * since its edges can look jagged due to lack of antialiasing. In this case, we are several
  74. * layers of box-shadow to add the border visually, which will render the border smoother. */
  75. @mixin box-shadow( $size ) {
  76. box-shadow:
  77. 0 0 0 $size $color__text-light inset, // Original border.
  78. 0 0 0 ($size + 1px) $color__text-light inset, // Antialiasing, inner edge.
  79. 0 0 1px 0 rgba( $color__text-light, 0.7 ); // Antialiasing, outer edge.
  80. }
  81. /* Calculates maximum width for post content */
  82. @mixin postContentMaxWidth() {
  83. @include media(tablet) {
  84. max-width: $size__site-tablet-content;
  85. }
  86. @include media(desktop) {
  87. max-width: $size__site-desktop-content;
  88. }
  89. }
  90. /* Nested sub-menu padding: 10 levels deep */
  91. @mixin nestedSubMenuPadding() {
  92. ul {
  93. counter-reset: submenu;
  94. }
  95. ul > li > a::before {
  96. font-family: $font__body;
  97. font-weight: normal;
  98. content: "\2013\00a0" counters(submenu, "\2013\00a0", none);
  99. counter-increment: submenu
  100. }
  101. }
  102. /* Ensure all font family declarations come with non-latin fallbacks */
  103. @mixin font-family( $font_family: $font__body ) {
  104. font-family: $font_family;
  105. @extend %non-latin-fonts;
  106. }
  107. /* Build our non-latin font styles */
  108. %non-latin-fonts {
  109. @each $lang, $font__fallback in $font__fallbacks {
  110. &:lang(#{$lang}) {
  111. font-family: unquote( $font__fallback );
  112. }
  113. }
  114. }
  115. @import "utilities";