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 CSS Foundations Advanced Selectors Substring Matching Attribute Selectors

Laksakan Krishnapillai
PLUS
Laksakan Krishnapillai
Courses Plus Student 1,839 Points

Understanding code

background: url(../images/pdf.png) no-repeat 0 2px;

The code above, i do not understand the no-repeat 0 2px that i followed on the video for advanced selectors. Can someone please explain to me.

3 Answers

"no-repeat" is telling the browser not to tile the image (example: http://www.w3schools.com/cssref/playit.asp?filename=playcss_background-repeat)

The 0 2px are position offsets for the image along the x and y axis. These specific numbers should mean the the background image is flat against the left side and 2 pixels from the top.

You can find more info here: http://www.w3schools.com/cssref/css3_pr_background.asp

geoffrey
geoffrey
28,736 Points

To be sure to answer correctly, no-repeat : the image won't be tiled, Then you have the value 0 2px, It's the background-position.

0 px from the left border and 2px from the top border.

Glad to have helped! :D