compass

https://github.com/chriseppstein/compass

CSS

Compass is no longer actively maintained. Compass is a Stylesheet Authoring Environment that makes your website design simpler to implement and easier to maintain.

Compass::SassExtensions::Functions::Sprites#sprite_position

Returns the position for the original image in the sprite.
This is suitable for use as a value to background-position:

    $icons: sprite-map("icons/*.png");
    background-position: sprite-position($icons, new);

Might generate something like:

    background-position: 0 -34px;

You can adjust the background relative to this position by passing values for
`$offset-x` and `$offset-y`:

    $icons: sprite-map("icons/*.png");
    background-position: sprite-position($icons, new, 3px, -2px);

Would change the above output to:

    background-position: 3px -36px;

If you set the `use_percentages` parameter to true, the position will be
expressed in percentages. An example:

    background-position: sprite-position($icons, new, 0, 0, true);

Would result in something like this:

    background-position: 0 42%;

Source | Google | Stack overflow

Edit

git clone [email protected]:chriseppstein/compass.git

cd compass

open cli/lib/compass/sass_extensions/functions/sprites.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-Compass--SassExtensions--Functions--Sprites-sprite_position-for-pr


# Commit to git

git add cli/lib/compass/sass_extensions/functions/sprites.rbgit commit -m "better docs for Compass::SassExtensions::Functions::Sprites#sprite_position"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-Compass--SassExtensions--Functions--Sprites-sprite_position-for-pr

hub pull-request


# Celebrate!