_mixins.scss 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382
  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. <<<<<<< HEAD
  18. /* Contain floats: nicolasgallagher.com/micro-clearfix-hack/ */
  19. .clearfix {
  20. &:before,
  21. &:after {
  22. content: "";
  23. display: table;
  24. }
  25. &:after {
  26. clear: both;
  27. }
  28. zoom: 1;
  29. =======
  30. // Contain floats: nicolasgallagher.com/micro-clearfix-hack/
  31. .clearfix {
  32. zoom: 1;
  33. &:before, &:after { content: ""; display: table; }
  34. &:after { clear: both; }
  35. >>>>>>> 1.3
  36. }
  37. /*********************
  38. TOOLS
  39. *********************/
  40. // BORDER-BOX ALL THE THINGS! (http://paulirish.com/2012/box-sizing-border-box-ftw/)
  41. * {
  42. -webkit-box-sizing: border-box;
  43. -moz-box-sizing: border-box;
  44. box-sizing: border-box;
  45. }
  46. // http://www.zeldman.com/2012/03/01/replacing-the-9999px-hack-new-image-replacement/
  47. .image-replacement {
  48. text-indent: 100%;
  49. white-space: nowrap;
  50. overflow: hidden;
  51. }
  52. /* apply a natural box layout model to all elements: http://paulirish.com/2012/box-sizing-border-box-ftw/ */
  53. * {
  54. -webkit-box-sizing: border-box;
  55. -moz-box-sizing: border-box;
  56. box-sizing: border-box;
  57. }
  58. /*********************
  59. COLORS
  60. Need help w/ choosing your colors? Try this site out:
  61. http://0to255.com/
  62. *********************/
  63. $alert-yellow: #ebe16f;
  64. $alert-red: #fbe3e4;
  65. $alert-green: #e6efc2;
  66. $alert-blue: #d5edf8;
  67. $black: #000;
  68. $white: #fff;
  69. $bones-pink: #f01d4f;
  70. $bones-blue: #1990db;
  71. $link-color: $bones-pink;
  72. <<<<<<< HEAD
  73. $link-hover: lighten($bones-pink, 9%);
  74. =======
  75. $link-hover: darken($link-color, 9%);
  76. /*
  77. Here's a great tutorial on how to
  78. use color variables properly:
  79. http://sachagreif.com/sass-color-variables/
  80. */
  81. >>>>>>> 1.3
  82. /*********************
  83. TYPOGRAPHY
  84. *********************/
  85. $sans-serif: "Helvetica Neue", Helvetica, Arial, sans-serif;
  86. $serif: "Georgia", Cambria, Times New Roman, Times, serif;
  87. /* To embed your own fonts, use this syntax
  88. and place your fonts inside the
  89. library/fonts folder. For more information
  90. on embedding fonts, go to:
  91. http://www.fontsquirrel.com/
  92. Be sure to remove the comment brackets.
  93. */
  94. /* @font-face {
  95. font-family: 'Font Name';
  96. src: url('library/fonts/font-name.eot');
  97. src: url('library/fonts/font-name.eot?#iefix') format('embedded-opentype'),
  98. url('library/fonts/font-name.woff') format('woff'),
  99. url('library/fonts/font-name.ttf') format('truetype'),
  100. url('library/fonts/font-name.svg#font-name') format('svg');
  101. font-weight: normal;
  102. font-style: normal;
  103. }
  104. */
  105. /*
  106. use the best ampersand
  107. http://simplebits.com/notebook/2008/08/14/ampersands-2/
  108. */
  109. span.amp {
  110. font-family: Baskerville,'Goudy Old Style',Palatino,'Book Antiqua',serif !important;
  111. font-style: italic;
  112. }
  113. // text alignment
  114. .text-left { text-align: left; }
  115. .text-center { text-align: center; }
  116. .text-right { text-align: right; }
  117. <<<<<<< HEAD
  118. /* alerts & notices */
  119. %alert {
  120. =======
  121. // alerts & notices
  122. .alert {
  123. >>>>>>> 1.3
  124. margin: 10px;
  125. padding: 5px 18px;
  126. border: 1px solid;
  127. }
  128. <<<<<<< HEAD
  129. .alert-help {
  130. @extend %alert;
  131. =======
  132. .help {
  133. >>>>>>> 1.3
  134. border-color: darken($alert-yellow, 5%);
  135. background: $alert-yellow;
  136. }
  137. <<<<<<< HEAD
  138. .alert-info {
  139. @extend %alert;
  140. =======
  141. .info {
  142. >>>>>>> 1.3
  143. border-color: darken($alert-blue, 5%);
  144. background: $alert-blue;
  145. }
  146. <<<<<<< HEAD
  147. .alert-error {
  148. @extend %alert;
  149. =======
  150. .error {
  151. >>>>>>> 1.3
  152. border-color: darken($alert-red, 5%);
  153. background: $alert-red;
  154. }
  155. <<<<<<< HEAD
  156. .alert-success {
  157. @extend %alert;
  158. =======
  159. .success {
  160. >>>>>>> 1.3
  161. border-color: darken($alert-green, 5%);
  162. background: $alert-green;
  163. }
  164. /*********************
  165. BORDER RADIUS
  166. *********************/
  167. /*
  168. <<<<<<< HEAD
  169. I totally rewrote this to be cleaner and easier to use.
  170. You'll need to be using Sass 3.2+ for these to work.
  171. Thanks to @anthonyshort for the inspiration on these.
  172. USAGE: @include border-radius(4px 4px 0 0);
  173. */
  174. =======
  175. NOTE: For older browser support (and some mobile),
  176. don't use the shorthand to define *different* corners.
  177. USAGE: @include rounded(4px);
  178. */
  179. @mixin rounded($radius: 4px) {
  180. -webkit-border-radius: $radius;
  181. -moz-border-radius: $radius;
  182. border-radius: $radius;
  183. }
  184. /*
  185. Instead of having a seperate mixin for the different
  186. borders, we're using the mixin from 320 & Up to make
  187. things easier to use.
  188. >>>>>>> 1.3
  189. @mixin border-radius($radius...) {
  190. // defining prefixes so we can use them in mixins below
  191. $prefixes: ("-webkit", "-moz", "-ms", "-o", "");
  192. @each $prefix in $prefixes {
  193. #{$prefix}-border-radius: $radius;
  194. }
  195. <<<<<<< HEAD
  196. border-radius: $radius;
  197. =======
  198. */
  199. @mixin border-radius($topright: 0, $bottomright: 0, $bottomleft: 0, $topleft: 0) {
  200. -webkit-border-top-right-radius: $topright;
  201. -webkit-border-bottom-right-radius: $bottomright;
  202. -webkit-border-bottom-left-radius: $bottomleft;
  203. -webkit-border-top-left-radius: $topleft;
  204. -moz-border-radius-topright: $topright;
  205. -moz-border-radius-bottomright: $bottomright;
  206. -moz-border-radius-bottomleft: $bottomleft;
  207. -moz-border-radius-topleft: $topleft;
  208. border-top-right-radius: $topright;
  209. border-bottom-right-radius: $bottomright;
  210. border-bottom-left-radius: $bottomleft;
  211. border-top-left-radius: $topleft;
  212. -webkit-background-clip: padding-box;
  213. -moz-background-clip: padding;
  214. background-clip: padding-box;
  215. >>>>>>> 1.3
  216. }
  217. /*********************
  218. TRANISTION
  219. *********************/
  220. /*
  221. I totally rewrote this to be cleaner and easier to use.
  222. You'll need to be using Sass 3.2+ for these to work.
  223. Thanks to @anthonyshort for the inspiration on these.
  224. USAGE: @include transition(all 0.2s ease-in-out);
  225. */
  226. @mixin transition($transition...) {
  227. // defining prefixes so we can use them in mixins below
  228. $prefixes: ("-webkit", "-moz", "-ms", "-o", "");
  229. @each $prefix in $prefixes {
  230. #{$prefix}-transition: $transition;
  231. }
  232. transition: $transition;
  233. }
  234. /*********************
  235. BOX SHADOWS
  236. *********************/
  237. /*
  238. I totally rewrote this to be cleaner and easier to use.
  239. You'll need to be using Sass 3.2+ for these to work.
  240. Thanks to @anthonyshort for the inspiration on these.
  241. USAGE: @include box-shadow(inset 0 0 4px rgba(0,0,0,0.22));
  242. */
  243. @mixin box-shadow($shadow...) {
  244. // defining prefixes so we can use them in mixins below
  245. $prefixes: ("-webkit", "-moz", "-ms", "-o", "");
  246. @each $prefix in $prefixes {
  247. #{$prefix}-box-shadow: $shadow;
  248. }
  249. box-shadow: $shadow;
  250. }
  251. /*********************
  252. CSS3 GRADIENTS
  253. Be careful with these since they can
  254. really slow down your CSS. Don't overdue it.
  255. *********************/
  256. /* @include css-gradient(#dfdfdf,#f8f8f8); */
  257. @mixin css-gradient($from: #dfdfdf, $to: #f8f8f8) {
  258. background-color: $to;
  259. background-image: -webkit-gradient(linear, left top, left bottom, from($from), to($to));
  260. background-image: -webkit-linear-gradient(top, $from, $to);
  261. background-image: -moz-linear-gradient(top, $from, $to);
  262. background-image: -o-linear-gradient(top, $from, $to);
  263. background-image: linear-gradient(to bottom, $from, $to);
  264. }
  265. /*********************
  266. BOX SIZING
  267. *********************/
  268. /* @include box-sizing(border-box); */
  269. /* NOTE: value of "padding-box" is only supported in Gecko. So
  270. probably best not to use it. I mean, were you going to anyway? */
  271. @mixin box-sizing($type: border-box) {
  272. -webkit-box-sizing: $type;
  273. -moz-box-sizing: $type;
  274. -ms-box-sizing: $type;
  275. box-sizing: $type;
  276. }
  277. /*********************
  278. BUTTONS
  279. *********************/
  280. .button, .button:visited {
  281. font-family: $sans-serif;
  282. border: 1px solid darken($link-color, 13%);
  283. border-top-color: darken($link-color, 7%);
  284. border-left-color: darken($link-color, 7%);
  285. padding: 4px 12px;
  286. color: $white;
  287. display: inline-block;
  288. font-size: 11px;
  289. font-weight: bold;
  290. text-decoration: none;
  291. text-shadow: 0 1px rgba(0,0,0, .75);
  292. cursor: pointer;
  293. margin-bottom: 20px;
  294. line-height: 21px;
  295. <<<<<<< HEAD
  296. @include border-radius(4px);
  297. =======
  298. @include rounded(4px);
  299. >>>>>>> 1.3
  300. @include css-gradient($link-color, darken($link-color, 5%));
  301. &:hover, &:focus {
  302. color: $white;
  303. border: 1px solid darken($link-color, 13%);
  304. border-top-color: darken($link-color, 20%);
  305. border-left-color: darken($link-color, 20%);
  306. @include css-gradient(darken($link-color, 5%), darken($link-color, 10%));
  307. }
  308. &:active {
  309. @include css-gradient(darken($link-color, 5%), $link-color);
  310. }
  311. }
  312. .blue-button, .blue-button:visited {
  313. border-color: darken($bones-blue, 10%);
  314. text-shadow: 0 1px 1px darken($bones-blue, 10%);
  315. @include css-gradient( $bones-blue, darken($bones-blue, 5%) );
  316. @include box-shadow(inset 0 0 3px lighten($bones-blue, 16%));
  317. &:hover, &:focus {
  318. border-color: darken($bones-blue, 15%);
  319. @include css-gradient( darken($bones-blue, 4%), darken($bones-blue, 10%) );
  320. }
  321. &:active {
  322. @include css-gradient( darken($bones-blue, 5%), $bones-blue );
  323. }
  324. }