_mixins.less 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. @import '_remixins.less';
  2. .radius(@val) {
  3. @rem-val: (unit(@val) / @base-font-size-px);
  4. border-radius:~"@{rem-val}rem";
  5. -moz-border-radius:~"@{rem-val}rem";
  6. -webkit-border-radius:~"@{rem-val}rem";
  7. -moz-background-clip: padding;
  8. -webkit-background-clip: padding-box;
  9. background-clip: padding-box;
  10. }
  11. .border (@width: 1px, @type: solid, @color: #ccc) {
  12. @rem-w: (unit(@width) / @base-font-size-px);
  13. border: ~"@{width} @{type} @{color}";
  14. border: ~"@{rem-w}rem @{type} @{color}";
  15. }
  16. .border-top (@width: 1px, @type: solid, @color: #ccc) {
  17. @rem-w: (unit(@width) / @base-font-size-px);
  18. border-top: ~"@{width} @{type} @{color}";
  19. border-top: ~"@{rem-w}rem @{type} @{color}";
  20. }
  21. .border-bottom (@width: 1px, @type: solid, @color: #ccc) {
  22. @rem-w: (unit(@width) / @base-font-size-px);
  23. border-bottom: ~"@{width} @{type} @{color}";
  24. border-bottom: ~"@{rem-w}rem @{type} @{color}";
  25. }
  26. .border-left (@width: 1px, @type: solid, @color: #ccc) {
  27. @rem-w: (unit(@width) / @base-font-size-px);
  28. border-left: ~"@{width} @{type} @{color}";
  29. border-left: ~"@{rem-w}rem @{type} @{color}";
  30. }
  31. .border-right (@width: 1px, @type: solid, @color: #ccc) {
  32. @rem-w: (unit(@width) / @base-font-size-px);
  33. border-right: ~"@{width} @{type} @{color}";
  34. border-right: ~"@{rem-w}rem @{type} @{color}";
  35. }
  36. .drop-shadow (@x: 0px, @y: 1px, @blur: 2px, @spread: 0px, @color: rgba(0, 0, 0, .25)) {
  37. @rem-x: (unit(@x) / @base-font-size-px);
  38. @rem-y: (unit(@y) / @base-font-size-px);
  39. @rem-b: (unit(@blur) / @base-font-size-px);
  40. @rem-s: (unit(@spread) / @base-font-size-px);
  41. -webkit-box-shadow: ~"@{rem-x}rem @{rem-y}rem @{rem-b}rem @{rem-s}rem rgba(0, 0, 0, @alpha)";
  42. -moz-box-shadow: ~"@{rem-x}rem @{rem-y}rem @{rem-b}rem @{rem-s}rem rgba(0, 0, 0, @alpha)";
  43. box-shadow: ~"@{rem-x}rem @{rem-y}rem @{rem-b}rem @{rem-s}rem rgba(0, 0, 0, @alpha)";
  44. }
  45. .box-sizing (@type: border-box) {
  46. -webkit-box-sizing: @type;
  47. -moz-box-sizing: @type;
  48. -ms-box-sizing: @type;
  49. box-sizing: @type;
  50. }
  51. .background-color (@color) {
  52. @a:percentage((1.0-alpha(@color))/5.0);
  53. background-color: hsl(hue(@color), saturation(@color), lightness(@color)+@a);
  54. background-color: @color;
  55. }
  56. .column-width (@width) {
  57. @rem-w: (unit(@width) / @base-font-size-px);
  58. -webkit-column-width: ~"@{rem-w}rem";
  59. -moz-column-width: ~"@{rem-w}rem";
  60. -ms-column-width: ~"@{rem-w}rem";
  61. column-width: ~"@{rem-w}rem";
  62. }
  63. .column-width-raw (@width) {
  64. -webkit-column-width: @width;
  65. -moz-column-width: @width;
  66. -ms-column-width: @width;
  67. column-width: @width;
  68. }
  69. .blur(@val) {
  70. -webkit-filter: blur(@val);
  71. -moz-filter: blur(@val);
  72. -o-filter: blur(@val);
  73. -ms-filter: blur(@val);
  74. filter: blur(@val);
  75. }