Let's start with an interesting query...
When using CSS sprites, you can create classes like .image-name
. This is precisely how Compass sprites function. Your image gets added to a larger sprite image, organizing all irregular images in a grid layout.
Although utilizing $icons-spacing
allows for adding padding to the grid, it might not be straightforward in this scenario. Therefore, we will proceed as follows based on the generated output.
If you desire an appearance similar to the example, centering the element with the Compass-generated class is essential.
Imagine you have an image named adventure.png
, generating the following class:
.icons-adventure {
background-position: 0 -608px;
}
To align this centrally, follow this approach:
<div class="border">
<i class="icons-adventure"></i>
</div>
For the border
class, apply padding. Essentially, wrap .border
around .icons-adventure
, then assign padding and width accordingly.
.border {padding: 15px; width: 40px;}
In this instance, height specification is unnecessary as it is automatically handled. Stay tuned for a demo that provides a comprehensive demonstration of these concepts.