_mixins.scss 7.2 KB

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