Blog-style website for karathan using the self-made Stellar Theme powered by HTML5Up http://blog.karathan.at

_mixins.scss 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /// Makes an element's :before pseudoelement a FontAwesome icon.
  2. /// @param {string} $content Optional content value to use.
  3. /// @param {string} $where Optional pseudoelement to target (before or after).
  4. @mixin icon($content: false, $where: before) {
  5. text-decoration: none;
  6. &:#{$where} {
  7. @if $content {
  8. content: $content;
  9. }
  10. -moz-osx-font-smoothing: grayscale;
  11. -webkit-font-smoothing: antialiased;
  12. font-family: FontAwesome;
  13. font-style: normal;
  14. font-weight: normal;
  15. text-transform: none !important;
  16. }
  17. }
  18. /// Applies padding to an element, taking the current element-margin value into account.
  19. /// @param {mixed} $tb Top/bottom padding.
  20. /// @param {mixed} $lr Left/right padding.
  21. /// @param {list} $pad Optional extra padding (in the following order top, right, bottom, left)
  22. /// @param {bool} $important If true, adds !important.
  23. @mixin padding($tb, $lr, $pad: (0,0,0,0), $important: null) {
  24. @if $important {
  25. $important: '!important';
  26. }
  27. $x: 0.1em;
  28. @if unit(_size(element-margin)) == 'rem' {
  29. $x: 0.1rem;
  30. }
  31. padding: ($tb + nth($pad,1)) ($lr + nth($pad,2)) max($x, $tb - _size(element-margin) + nth($pad,3)) ($lr + nth($pad,4)) #{$important};
  32. }
  33. /// Encodes a SVG data URL so IE doesn't choke (via codepen.io/jakob-e/pen/YXXBrp).
  34. /// @param {string} $svg SVG data URL.
  35. /// @return {string} Encoded SVG data URL.
  36. @function svg-url($svg) {
  37. $svg: str-replace($svg, '"', '\'');
  38. $svg: str-replace($svg, '%', '%25');
  39. $svg: str-replace($svg, '<', '%3C');
  40. $svg: str-replace($svg, '>', '%3E');
  41. $svg: str-replace($svg, '&', '%26');
  42. $svg: str-replace($svg, '#', '%23');
  43. $svg: str-replace($svg, '{', '%7B');
  44. $svg: str-replace($svg, '}', '%7D');
  45. $svg: str-replace($svg, ';', '%3B');
  46. @return url("data:image/svg+xml;charset=utf8,#{$svg}");
  47. }