Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS

Adding the Feature Icons I am confused as to how this works Gill use a png image to load some icons separately

In the lesson by Gill he uses a image called feature-icons.png and loads them using css into different divs using some clever css:

ft-icon::before { content: ""; display: block; position: absolute; width: 164px; height: 102px; top: 0; right: 0; bottom: 0; left: 0; margin: auto; background: url('../img/feature-icons.png') no-repeat; background-size: 100%; }

but some how rather than the whole image being loaded it only loads one of the icons eg camera or clouds or friends:

how does this work?

HTML:

<div class="ft-icon friends"> </div> </div>

This loads the friends icon but friends is not explicitly defined and why is not the whole image loaded?

Here is the url but i think i have worked it out

https://teamtreehouse.com/library/framework-basics/build-a-website-with-bootstrap/adding-the-feature-icons

Hi Laurence,

Can you link to the video you're on right now?

1 Answer

He has the rules for .ft-icon.friends, etc. which mean an element with both the ft-icon and friends classes.

In those, he changes the background position to only show one of the icons. It's basically a sprite sheet.