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 Basics (2014) Basic Layout Backgrounds: Color and Images

Sean Smith
PLUS
Sean Smith
Courses Plus Student 2,353 Points

Background Header disappears when I add background-size or background-repeat.

Using atom as text editor. Added background image, image shows up no problem. When background-size or background-repeat are added, image disappears. Image reappears when background-size and background-repeat are commented out.

.main-header { background-color: #ffa949; padding-top: 170px; height: 850px; background-image: url(../img/mountains.jpg) /* background-size: 40% background-repeat:no-repeat; */ }

2 Answers

Steven Parker
Steven Parker
229,744 Points

I notice the semicolons that should separate the "background-image", "background-size" and "background-repeat" properties are missing. That most likely causes the entire rule be ignored.

Victor Rebello
Victor Rebello
2,322 Points

Agree with Steven. Also you missed the inverted commas inside the parenthesis. Try using the inverted commas. Good Practice. Happy coding ! :D

Steven Parker
Steven Parker
229,744 Points

:information_source: FYI: quotes ("inverted commas") are optional in url() notation.