mixins.scss 7.9 KB

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