mixins.less 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. /******************************************************************
  2. Site Name:
  3. Author:
  4. Stylesheet: Mixins & Constants Stylesheet
  5. This is where you can take advantage of LESS' great features:
  6. Mixins & Constants. I won't go in-depth on how they work exactly,
  7. there are a few articles below that will help do that. What I will
  8. tell you is that this will help speed up simple changes like
  9. changing a color or adding CSS3 techniques like box shadow and
  10. border-radius.
  11. A WORD OF WARNING: It's very easy to overdo it here. Be careful and
  12. remember LESS is more. See what I did there? Nice.
  13. Helpful Articles or Links:
  14. http://www.sitepoint.com/a-comprehensive-introduction-to-less-mixins/
  15. (Have a useful link? add a pull request and I'll add it. Just don't make
  16. it to spammy. let's keep this legit.)
  17. ******************************************************************/
  18. /*********************
  19. CLEARFIXIN'
  20. *********************/
  21. /* Contain floats: nicolasgallagher.com/micro-clearfix-hack/ */
  22. .clearfix {
  23. &:before,
  24. &:after {
  25. content: "";
  26. display: table;
  27. }
  28. &:after {
  29. clear: both;
  30. }
  31. /* for IE */
  32. zoom: 1;
  33. }
  34. /*********************
  35. TOOLS
  36. *********************/
  37. /* http://www.zeldman.com/2012/03/01/replacing-the-9999px-hack-new-image-replacement/ */
  38. .image-replacement {
  39. text-indent: 100%;
  40. white-space: nowrap;
  41. overflow: hidden;
  42. }
  43. /*********************
  44. COLORS
  45. Need help w/ choosing your colors? Try this site out:
  46. http://0to255.com/
  47. *********************/
  48. @yellow: #ebe16f;
  49. @red: #fbe3e4;
  50. @green: #e6efc2;
  51. @blue: #d5edf8;
  52. @black: #000;
  53. @grayDarker: lighten(@black, 10%);
  54. @grayDark: lighten(@black, 25%);
  55. @gray: lighten(@black, 50%);
  56. @grayLight: lighten(@black, 75%);
  57. @grayLighter: lighten(@black, 90%);
  58. @white: #fff;
  59. /* this is pulled from Bootstrap */
  60. @baseColor: @blue; // Set a base color
  61. @complement: spin(@baseColor, 180); // Determine a complementary color
  62. @split1: spin(@baseColor, 158); // Split complements
  63. @split2: spin(@baseColor, -158);
  64. @triad1: spin(@baseColor, 135); // Triads colors
  65. @triad2: spin(@baseColor, -135);
  66. @tetra1: spin(@baseColor, 90); // Tetra colors
  67. @tetra2: spin(@baseColor, -90);
  68. @analog1: spin(@baseColor, 22); // Analogs colors
  69. @analog2: spin(@baseColor, -22);
  70. /*********************
  71. TYPOGRAPHY
  72. *********************/
  73. @sans-serif: "Helvetica Neue", Helvetica, Arial, sans-serif;
  74. @serif: "Georgia", Cambria, Times New Roman, Times, serif;
  75. /* To embed your own fonts, use this syntax
  76. and place your fonts inside the
  77. library/fonts folder. For more information
  78. on embedding fonts, go to:
  79. http://www.fontsquirrel.com/
  80. Be sure to remove the comment brackets.
  81. */
  82. /* @font-face {
  83. font-family: 'Font Name';
  84. src: url('../fonts/font-name.eot');
  85. src: url('../fonts/font-name.eot?#iefix') format('embedded-opentype'),
  86. url('../fonts/font-name.woff') format('woff'),
  87. url('../fonts/font-name.ttf') format('truetype'),
  88. url('../fonts/font-name.svg#font-name') format('svg');
  89. font-weight: normal;
  90. font-style: normal;
  91. }
  92. */
  93. /*
  94. use the best ampersand
  95. http://simplebits.com/notebook/2008/08/14/ampersands-2/
  96. */
  97. span.amp {
  98. font-family: Baskerville,'Goudy Old Style',Palatino,'Book Antiqua',serif;
  99. font-style: italic;
  100. }
  101. /* text alignment */
  102. .text-left { text-align: left; }
  103. .text-center { text-align: center; }
  104. .text-right { text-align: right; }
  105. /*********************
  106. ALERTS & NOTICES
  107. *********************/
  108. .help, .info, .error, .success {
  109. margin: 10px;
  110. padding: 5px 18px;
  111. border: 1px solid;
  112. }
  113. .help {
  114. border-color: darken(@yellow, 5%);
  115. background: @yellow;
  116. }
  117. .info {
  118. border-color: darken(@blue, 5%);
  119. background: @blue;
  120. }
  121. .error {
  122. border-color: darken(@red, 5%);
  123. background: @red;
  124. }
  125. .success {
  126. border-color: darken(@green, 5%);
  127. background: @green;
  128. }
  129. /*********************
  130. BORDER RADIUS
  131. *********************/
  132. /* .borderRadius(4px); */
  133. .borderRadius(@radius: 4px) {
  134. -webkit-border-radius: @radius;
  135. -moz-border-radius: @radius;
  136. -ms-border-radius: @radius;
  137. -o-border-radius: @radius;
  138. border-radius: @radius;
  139. }
  140. /* .borderRadius-left(4px); */
  141. .borderRadius-left(@radius: 4px) {
  142. -webkit-border-bottom-left-radius: @radius;
  143. -webkit-border-top-left-radius: @radius;
  144. -moz-border-radius-bottomleft: @radius;
  145. -moz-border-radius-topleft: @radius;
  146. border-bottom-left-radius: @radius;
  147. border-top-left-radius: @radius;
  148. }
  149. /* .borderRadius-right(4px); */
  150. .borderRadius-right(@radius: 4px) {
  151. -webkit-border-bottom-right-radius: @radius;
  152. -webkit-border-top-right-radius: @radius;
  153. -moz-border-radius-bottomright: @radius;
  154. -moz-border-radius-topright: @radius;
  155. border-bottom-right-radius: @radius;
  156. border-top-right-radius: @radius;
  157. }
  158. /* .borderRadius-bottom(4px); */
  159. .borderRadius-bottom(@radius: 4px) {
  160. -webkit-border-bottom-right-radius: @radius;
  161. -webkit-border-bottom-left-radius: @radius;
  162. -moz-border-radius-bottomright: @radius;
  163. -moz-border-radius-bottomleft: @radius;
  164. border-bottom-right-radius: @radius;
  165. border-bottom-left-radius: @radius;
  166. }
  167. /* .borderRadius-top(4px); */
  168. .borderRadius-top(@radius: 4px) {
  169. -webkit-border-top-right-radius: @radius;
  170. -webkit-border-top-left-radius: @radius;
  171. -moz-border-radius-topright: @radius;
  172. -moz-border-radius-topleft: @radius;
  173. border-top-right-radius: @radius;
  174. border-top-left-radius: @radius;
  175. }
  176. /*********************
  177. TRANISTION
  178. *********************/
  179. /* .transition(all,2s); */
  180. .transition(@what: all, @time: 0.2s) {
  181. -webkit-transition: @what @time ease-out;
  182. -moz-transition: @what @time ease-out;
  183. -ms-transition: @what @time ease-out;
  184. -o-transition: @what @time ease-out;
  185. transition: @what @time ease-out;
  186. }
  187. /*********************
  188. CSS3 GRADIENTS
  189. Be careful with these since they can
  190. really slow down your CSS. Don't overdue it.
  191. *********************/
  192. /* .css-gradient(#dfdfdf,#f8f8f8); */
  193. .css-gradient(@from: #dfdfdf, @to: #f8f8f8) {
  194. background-color: @to;
  195. background-image: -webkit-gradient(linear, left top, left bottom, from(@from), to(@to));
  196. background-image: -webkit-linear-gradient(top, @from, @to);
  197. background-image: -moz-linear-gradient(top, @from, @to);
  198. background-image: -o-linear-gradient(top, @from, @to);
  199. background-image: -ms-linear-gradient(top, @from, @to);
  200. background-image: linear-gradient(top, @from, @to);
  201. }
  202. /*********************
  203. BOX SIZING
  204. *********************/
  205. /* .boxSizing(border-box); */
  206. .boxSizing(@type: border-box) {
  207. -webkit-box-sizing: @type;
  208. -moz-box-sizing: @type;
  209. -ms-box-sizing: @type;
  210. -o-box-sizing: @type;
  211. box-sizing: @type;
  212. }
  213. /*********************
  214. BOX SHADOW
  215. *********************/
  216. /* .boxShadow(0 0 4px #444); */
  217. .boxShadow(@x: 0, @y: 0, @radius: 4px, @spread: 0, @color: rgba(0,0,0,0.5)) {
  218. -webkit-box-shadow: @x @y @radius @spread @color;
  219. -moz-box-shadow: @x @y @radius @spread @color;
  220. -ms-box-shadow: @x @y @radius @spread @color;
  221. -o-box-shadow: @x @y @radius @spread @color;
  222. box-shadow: @x @y @radius @spread @color;
  223. }
  224. /*********************
  225. BUTTONS
  226. *********************/
  227. .button, .button:visited {
  228. border: 1px solid darken(@blue, 13%);
  229. border-top-color: darken(@blue, 7%);
  230. border-left-color: darken(@blue, 7%);
  231. padding: 4px 12px;
  232. color: @white;
  233. display: inline-block;
  234. font-size: 11px;
  235. font-weight: bold;
  236. text-decoration: none;
  237. text-shadow: 0 1px rgba(0,0,0, .75);
  238. cursor: pointer;
  239. margin-bottom: 20px;
  240. line-height: 21px;
  241. .transition();
  242. .borderRadius(4px);
  243. .css-gradient(@blue,darken(@blue, 5%));
  244. &:hover, &:focus {
  245. color: @white;
  246. border: 1px solid darken(@blue, 13%);
  247. border-top-color: darken(@blue, 20%);
  248. border-left-color: darken(@blue, 20%);
  249. .css-gradient(darken(@blue, 5%),darken(@blue, 10%));
  250. }
  251. &:active {
  252. .css-gradient(darken(@blue, 5%),@blue);
  253. }
  254. }