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
Code Pack
1,978 Pointshtml tag ain't working in stylesheet and Wroking in <STYLE></STYLE>
I've added html attribute to my stylesheet with background styles but it didn't worked out
-- code as below --
html {
background-color: #867e71;
background: url('img/bg.jpg') no-repeat center center fixed ;
background-size: cover;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
}
2 Answers
Dustin Matlock
33,856 PointsHello, your code seems to work on my end. Do you maybe have some more code that could be interfering? If you want to provide that, we can take a look at it for you. Otherwise, you can also zip the project up and upload it to Dropbox. CodePen might also work.
I fixed code highlighting for you. The animation below shows how to post code at Treehouse.
Robert Richey
Courses Plus Student 16,352 PointsThis stackoverflow answer tries to explain it. http://stackoverflow.com/questions/4122727/internet-explorer-doesnt-recognise-the-html-css-background-image-tag
tl;dr the html element is not meant to hold images.
body {
background-color: #867e71;
background: url('img/bg.jpg') no-repeat center center fixed ;
background-size: cover;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
}
Code Pack
1,978 PointsThanks Robert,
It's working now.

Code Pack
1,978 PointsCode Pack
1,978 PointsThanks Matlock,
It's working now.