_mixins.scss 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. /******************************************************************
  2. Site Name:
  3. Author:
  4. Stylesheet: Mixins & Constants Stylesheet
  5. This is where you can take advantage of Sass' 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. zoom: 1;
  20. &:before, &:after { content: ""; display: table; }
  21. &:after { clear: both; }
  22. }
  23. /*********************
  24. TOOLS
  25. *********************/
  26. // BORDER-BOX ALL THE THINGS! (http://paulirish.com/2012/box-sizing-border-box-ftw/)
  27. * {
  28. -webkit-box-sizing: border-box;
  29. -moz-box-sizing: border-box;
  30. box-sizing: border-box;
  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. /* apply a natural box layout model to all elements: http://paulirish.com/2012/box-sizing-border-box-ftw/ */
  39. * {
  40. -webkit-box-sizing: border-box;
  41. -moz-box-sizing: border-box;
  42. box-sizing: border-box;
  43. }
  44. /*********************
  45. COLORS
  46. Need help w/ choosing your colors? Try this site out:
  47. http://0to255.com/
  48. *********************/
  49. $alert-yellow: #ebe16f;
  50. $alert-red: #fbe3e4;
  51. $alert-green: #e6efc2;
  52. $alert-blue: #d5edf8;
  53. $black: #000;
  54. $white: #fff;
  55. $bones-pink: #f01d4f;
  56. $bones-blue: #1990db;
  57. $link-color: $bones-pink;
  58. $link-hover: darken($link-color, 9%);
  59. /*
  60. Here's a great tutorial on how to
  61. use color variables properly:
  62. http://sachagreif.com/sass-color-variables/
  63. */
  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 !important;
  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 and notices
  100. %alert {
  101. margin: 10px;
  102. padding: 5px 18px;
  103. border: 1px solid;
  104. }
  105. .alert-help {
  106. @extend %alert;
  107. border-color: darken($alert-yellow, 5%);
  108. background: $alert-yellow;
  109. }
  110. .alert-info {
  111. @extend %alert;
  112. border-color: darken($alert-blue, 5%);
  113. background: $alert-blue;
  114. }
  115. .alert-error {
  116. @extend %alert;
  117. border-color: darken($alert-red, 5%);
  118. background: $alert-red;
  119. }
  120. .alert-success {
  121. @extend %alert;
  122. border-color: darken($alert-green, 5%);
  123. background: $alert-green;
  124. }
  125. /*********************
  126. BORDER RADIUS
  127. *********************/
  128. /*
  129. I totally rewrote this to be cleaner and easier to use.
  130. You'll need to be using Sass 3.2+ for these to work.
  131. Thanks to @anthonyshort for the inspiration on these.
  132. USAGE: @include border-radius(4px 4px 0 0);
  133. */
  134. @mixin border-radius($radius...) {
  135. // defining prefixes so we can use them in mixins below
  136. $prefixes: ("-webkit", "-moz", "-ms", "-o", "");
  137. @each $prefix in $prefixes {
  138. #{$prefix}-border-radius: $radius;
  139. }
  140. border-radius: $radius;
  141. }
  142. /*********************
  143. TRANISTION
  144. *********************/
  145. /*
  146. I totally rewrote this to be cleaner and easier to use.
  147. You'll need to be using Sass 3.2+ for these to work.
  148. Thanks to @anthonyshort for the inspiration on these.
  149. USAGE: @include transition(all 0.2s ease-in-out);
  150. */
  151. @mixin transition($transition...) {
  152. // defining prefixes so we can use them in mixins below
  153. $prefixes: ("-webkit", "-moz", "-ms", "-o", "");
  154. @each $prefix in $prefixes {
  155. #{$prefix}-transition: $transition;
  156. }
  157. transition: $transition;
  158. }
  159. /*********************
  160. BOX SHADOWS
  161. *********************/
  162. /*
  163. I totally rewrote this to be cleaner and easier to use.
  164. You'll need to be using Sass 3.2+ for these to work.
  165. Thanks to @anthonyshort for the inspiration on these.
  166. USAGE: @include box-shadow(inset 0 0 4px rgba(0,0,0,0.22));
  167. */
  168. @mixin box-shadow($shadow...) {
  169. // defining prefixes so we can use them in mixins below
  170. $prefixes: ("-webkit", "-moz", "-ms", "-o", "");
  171. @each $prefix in $prefixes {
  172. #{$prefix}-box-shadow: $shadow;
  173. }
  174. box-shadow: $shadow;
  175. }
  176. /*********************
  177. CSS3 GRADIENTS
  178. Be careful with these since they can
  179. really slow down your CSS. Don't overdue it.
  180. *********************/
  181. /* @include css-gradient(#dfdfdf,#f8f8f8); */
  182. @mixin css-gradient($from: #dfdfdf, $to: #f8f8f8) {
  183. background-color: $to;
  184. background-image: -webkit-gradient(linear, left top, left bottom, from($from), to($to));
  185. background-image: -webkit-linear-gradient(top, $from, $to);
  186. background-image: -moz-linear-gradient(top, $from, $to);
  187. background-image: -o-linear-gradient(top, $from, $to);
  188. background-image: linear-gradient(to bottom, $from, $to);
  189. }
  190. /*********************
  191. BOX SIZING
  192. *********************/
  193. /* @include box-sizing(border-box); */
  194. /* NOTE: value of "padding-box" is only supported in Gecko. So
  195. probably best not to use it. I mean, were you going to anyway? */
  196. @mixin box-sizing($type: border-box) {
  197. -webkit-box-sizing: $type;
  198. -moz-box-sizing: $type;
  199. -ms-box-sizing: $type;
  200. box-sizing: $type;
  201. }
  202. /*********************
  203. BUTTONS
  204. *********************/
  205. .button, .button:visited {
  206. font-family: $sans-serif;
  207. border: 1px solid darken($link-color, 13%);
  208. border-top-color: darken($link-color, 7%);
  209. border-left-color: darken($link-color, 7%);
  210. padding: 4px 12px;
  211. color: $white;
  212. display: inline-block;
  213. font-size: 11px;
  214. font-weight: bold;
  215. text-decoration: none;
  216. text-shadow: 0 1px rgba(0,0,0, .75);
  217. cursor: pointer;
  218. margin-bottom: 20px;
  219. line-height: 21px;
  220. @include border-radius(4px);
  221. @include css-gradient($link-color, darken($link-color, 5%));
  222. &:hover, &:focus {
  223. color: $white;
  224. border: 1px solid darken($link-color, 13%);
  225. border-top-color: darken($link-color, 20%);
  226. border-left-color: darken($link-color, 20%);
  227. @include css-gradient(darken($link-color, 5%), darken($link-color, 10%));
  228. }
  229. &:active {
  230. @include css-gradient(darken($link-color, 5%), $link-color);
  231. }
  232. }
  233. .blue-button, .blue-button:visited {
  234. border-color: darken($bones-blue, 10%);
  235. text-shadow: 0 1px 1px darken($bones-blue, 10%);
  236. @include css-gradient( $bones-blue, darken($bones-blue, 5%) );
  237. @include box-shadow(inset 0 0 3px lighten($bones-blue, 16%));
  238. &:hover, &:focus {
  239. border-color: darken($bones-blue, 15%);
  240. @include css-gradient( darken($bones-blue, 4%), darken($bones-blue, 10%) );
  241. }
  242. &:active {
  243. @include css-gradient( darken($bones-blue, 5%), $bones-blue );
  244. }
  245. }