_mixins.scss 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  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. /*********************
  39. COLORS
  40. Need help w/ choosing your colors? Try this site out:
  41. http://0to255.com/
  42. *********************/
  43. $alert-yellow: #ebe16f;
  44. $alert-red: #fbe3e4;
  45. $alert-green: #e6efc2;
  46. $alert-blue: #d5edf8;
  47. $black: #000;
  48. $white: #fff;
  49. $bones-pink: #f01d4f;
  50. $bones-blue: #1990db;
  51. $link-color: $bones-pink;
  52. $link-hover: darken($link-color, 9%);
  53. /*
  54. Here's a great tutorial on how to
  55. use color variables properly:
  56. http://sachagreif.com/sass-color-variables/
  57. */
  58. /*********************
  59. TYPOGRAPHY
  60. *********************/
  61. $sans-serif: "Helvetica Neue", Helvetica, Arial, sans-serif;
  62. $serif: "Georgia", Cambria, Times New Roman, Times, serif;
  63. /* To embed your own fonts, use this syntax
  64. and place your fonts inside the
  65. library/fonts folder. For more information
  66. on embedding fonts, go to:
  67. http://www.fontsquirrel.com/
  68. Be sure to remove the comment brackets.
  69. */
  70. /* @font-face {
  71. font-family: 'Font Name';
  72. src: url('library/fonts/font-name.eot');
  73. src: url('library/fonts/font-name.eot?#iefix') format('embedded-opentype'),
  74. url('library/fonts/font-name.woff') format('woff'),
  75. url('library/fonts/font-name.ttf') format('truetype'),
  76. url('library/fonts/font-name.svg#font-name') format('svg');
  77. font-weight: normal;
  78. font-style: normal;
  79. }
  80. */
  81. /*
  82. use the best ampersand
  83. http://simplebits.com/notebook/2008/08/14/ampersands-2/
  84. */
  85. span.amp {
  86. font-family: Baskerville,'Goudy Old Style',Palatino,'Book Antiqua',serif !important;
  87. font-style: italic;
  88. }
  89. // text alignment
  90. .text-left { text-align: left; }
  91. .text-center { text-align: center; }
  92. .text-right { text-align: right; }
  93. // alerts and notices
  94. %alert {
  95. margin: 10px;
  96. padding: 5px 18px;
  97. border: 1px solid;
  98. }
  99. .alert-help {
  100. @extend %alert;
  101. border-color: darken($alert-yellow, 5%);
  102. background: $alert-yellow;
  103. }
  104. .alert-info {
  105. @extend %alert;
  106. border-color: darken($alert-blue, 5%);
  107. background: $alert-blue;
  108. }
  109. .alert-error {
  110. @extend %alert;
  111. border-color: darken($alert-red, 5%);
  112. background: $alert-red;
  113. }
  114. .alert-success {
  115. @extend %alert;
  116. border-color: darken($alert-green, 5%);
  117. background: $alert-green;
  118. }
  119. /*********************
  120. BORDER RADIUS
  121. *********************/
  122. /*
  123. I totally rewrote this to be cleaner and easier to use.
  124. You'll need to be using Sass 3.2+ for these to work.
  125. Thanks to @anthonyshort for the inspiration on these.
  126. USAGE: @include border-radius(4px 4px 0 0);
  127. */
  128. @mixin border-radius($radius...) {
  129. // defining prefixes so we can use them in mixins below
  130. $prefixes: ("-webkit", "-moz", "-ms", "-o", "");
  131. @each $prefix in $prefixes {
  132. #{$prefix}-border-radius: $radius;
  133. }
  134. border-radius: $radius;
  135. }
  136. /*********************
  137. TRANISTION
  138. *********************/
  139. /*
  140. I totally rewrote this to be cleaner and easier to use.
  141. You'll need to be using Sass 3.2+ for these to work.
  142. Thanks to @anthonyshort for the inspiration on these.
  143. USAGE: @include transition(all 0.2s ease-in-out);
  144. */
  145. @mixin transition($transition...) {
  146. // defining prefixes so we can use them in mixins below
  147. $prefixes: ("-webkit", "-moz", "-ms", "-o", "");
  148. @each $prefix in $prefixes {
  149. #{$prefix}-transition: $transition;
  150. }
  151. transition: $transition;
  152. }
  153. /*********************
  154. BOX SHADOWS
  155. *********************/
  156. /*
  157. I totally rewrote this to be cleaner and easier to use.
  158. You'll need to be using Sass 3.2+ for these to work.
  159. Thanks to @anthonyshort for the inspiration on these.
  160. USAGE: @include box-shadow(inset 0 0 4px rgba(0,0,0,0.22));
  161. */
  162. @mixin box-shadow($shadow...) {
  163. // defining prefixes so we can use them in mixins below
  164. $prefixes: ("-webkit", "-moz", "-ms", "-o", "");
  165. @each $prefix in $prefixes {
  166. #{$prefix}-box-shadow: $shadow;
  167. }
  168. box-shadow: $shadow;
  169. }
  170. /*********************
  171. CSS3 GRADIENTS
  172. Be careful with these since they can
  173. really slow down your CSS. Don't overdue it.
  174. *********************/
  175. /* @include css-gradient(#dfdfdf,#f8f8f8); */
  176. @mixin css-gradient($from: #dfdfdf, $to: #f8f8f8) {
  177. background-color: $to;
  178. background-image: -webkit-gradient(linear, left top, left bottom, from($from), to($to));
  179. background-image: -webkit-linear-gradient(top, $from, $to);
  180. background-image: -moz-linear-gradient(top, $from, $to);
  181. background-image: -o-linear-gradient(top, $from, $to);
  182. background-image: linear-gradient(to bottom, $from, $to);
  183. }
  184. /*********************
  185. BOX SIZING
  186. *********************/
  187. /* @include box-sizing(border-box); */
  188. /* NOTE: value of "padding-box" is only supported in Gecko. So
  189. probably best not to use it. I mean, were you going to anyway? */
  190. @mixin box-sizing($type: border-box) {
  191. -webkit-box-sizing: $type;
  192. -moz-box-sizing: $type;
  193. -ms-box-sizing: $type;
  194. box-sizing: $type;
  195. }
  196. /*********************
  197. BUTTONS
  198. *********************/
  199. .button, .button:visited {
  200. font-family: $sans-serif;
  201. border: 1px solid darken($link-color, 13%);
  202. border-top-color: darken($link-color, 7%);
  203. border-left-color: darken($link-color, 7%);
  204. padding: 4px 12px;
  205. color: $white;
  206. display: inline-block;
  207. font-size: 11px;
  208. font-weight: bold;
  209. text-decoration: none;
  210. text-shadow: 0 1px rgba(0,0,0, .75);
  211. cursor: pointer;
  212. margin-bottom: 20px;
  213. line-height: 21px;
  214. @include border-radius(4px);
  215. @include css-gradient($link-color, darken($link-color, 5%));
  216. &:hover, &:focus {
  217. color: $white;
  218. border: 1px solid darken($link-color, 13%);
  219. border-top-color: darken($link-color, 20%);
  220. border-left-color: darken($link-color, 20%);
  221. @include css-gradient(darken($link-color, 5%), darken($link-color, 10%));
  222. }
  223. &:active {
  224. @include css-gradient(darken($link-color, 5%), $link-color);
  225. }
  226. }
  227. .blue-button, .blue-button:visited {
  228. border-color: darken($bones-blue, 10%);
  229. text-shadow: 0 1px 1px darken($bones-blue, 10%);
  230. @include css-gradient( $bones-blue, darken($bones-blue, 5%) );
  231. @include box-shadow(inset 0 0 3px lighten($bones-blue, 16%));
  232. &:hover, &:focus {
  233. border-color: darken($bones-blue, 15%);
  234. @include css-gradient( darken($bones-blue, 4%), darken($bones-blue, 10%) );
  235. }
  236. &:active {
  237. @include css-gradient( darken($bones-blue, 5%), $bones-blue );
  238. }
  239. }