Skip to content

Instantly share code, notes, and snippets.

@archan937
Created September 6, 2010 07:34
Show Gist options
  • Save archan937/566754 to your computer and use it in GitHub Desktop.
Save archan937/566754 to your computer and use it in GitHub Desktop.
Mixins for SASS in combination with Compass and Lemonade to render indented text displayed with a sprite-image (IE6 compatible)
=block
display: block
=clear
*display: inline-block
&:after
content: " "
height: 0
+block
clear: both
visibility: hidden
=indent
text-indent: -9999px
+clear
+block
=sprite_image(!url)
width: image-width(!url)
height: image-height(!url)
line-height: image-height(!url)
background: sprite-image(!url) no-repeat
-background: none
-filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="/images/#{!url}", sizingMethod="scale")
=text_image(!url)
+sprite_image(!url)
+indent
h1.rails_gems
+text-image("sprite/text-rails_gems.png")
@hagenburger
Copy link

I think it will work. Here are some improvements:

  • Please use Sass 3.0 syntax (e. g. $url instead of deprecated !url)
  • Compass provides standard mixins for clearfixe and hide-text.
  • Be consistent and change underscores to dashes

Are you using the sprite image as text alternative? If so I would suggest to use typkit or another service for custom fonts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment