// This file contains helpers for using stylus in your project.
//
// Put something like this in your styl.styl:
-// @require 'code/wfpl/stylus-helpers.styl'
+// @require 'inc/wfpl/stylus-helpers.styl'
// set units to px if it doesn't have a unit already
// html:
// <nav>
// <ul>
-// <li class="n1">home</li>
-// <li class="n2">contact</li>
+// <li class="n0">home</li>
+// <li class="n1">contact</li>
// </ul>
// </nav>
// styl:
// nav li
// sprite-rollover "images/nav.png" 150 35 2
-sprite-rollover(image, width, height, count)
- width = unit(width, px)
- height = unit(height, px)
- width width
- height height
- background: transparent url(image) top left no-repeat;
- for n in (1..count)
+sprites-rollover(image, width, height, count, v-offset = 0, h-offset = 0)
+ width: unit(width, px)
+ height: unit(height, px)
+ background-image: url(image)
+ background-position: top left
+ background-repeat: no-repeat;
+ for n in (0...count)
&.n{n}
- y = (height - n * height)
- background-position 0 y
+ y = - (@height * n) - unit(v-offset, px)
+ background-position (0 - unit(h-offset, px)) y
&:hover
- background-position -(width) y
+ background-position (0 - unit(h-offset, px) - @width) y
+// see sprites-rollover
+sprites(image, height, count, v-offset = 0, h-offset = 0)
+ height: unit(height, px)
+ background-image: url(image)
+ background-position: top left
+ background-repeat: no-repeat;
+ for n in (0...count)
+ &.n{n}
+ y = - (@height * n) - unit(v-offset, px)
+ background-position (0 - unit(h-offset, px)) y
// Styling for a variable height element with an image background where the
// middle repeats vertically. You must split your image into three images, and
margin 0
padding 0
list-style none
+
+// Example:
+// input
+// +placeholder()
+// color: red
+placeholder()
+ &::-webkit-input-placeholder
+ {block}
+ &:-moz-placeholder // firefox 4-18
+ {block}
+ &::-moz-placeholder // firefox 19+
+ {block}
+ &:-ms-input-placeholder // ie
+ {block}
+
+// Example:
+// div.button
+// noselect()
+noselect()
+ -webkit-touch-callout: none
+ -webkit-user-select: none
+ -khtml-user-select: none
+ -moz-user-select: none
+ -ms-user-select: none
+ user-select: none