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 trialSahar Nasiri
7,454 Pointsbackground-repeat
What does Nick mean by saying that backgrounds repeat by default in CSS?
2 Answers
Jonathan Walz
21,429 PointsWhen the dimensions the image set to the background is smaller than the area it is being asked to cover, it will by default, repeat to fill the space.
Check out MDNs documentation about display: https://developer.mozilla.org/en-US/docs/Web/CSS/display
Fábio Tavares da Costa
11,985 PointsHe means that the image will repeat itself like like tiles in a wall.
.default-equal-to {
// browsers will apply it, no need to declare yourself
background-repeat: repeat;
}
.prevent-default-equal-to {
// now your img will show only once
background-repeat: no-repeat;
// now your img will repeat only horizontally
background-repeat: repeat-x;
// now your img will repeat only vertically
background-repeat: repeat-y;
}
Sahar Nasiri
7,454 PointsTnx ;)
Sahar Nasiri
7,454 PointsSahar Nasiri
7,454 PointsTnx :). It really helps.
Sahar Nasiri
7,454 PointsSahar Nasiri
7,454 PointsTnx :). It really helps.
Jonathan Walz
21,429 PointsJonathan Walz
21,429 PointsMy pleasure. Please mark as best answer. It helps me try to get a job!