_mixins.scss 6.2 KB

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