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!
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

erdragerdragsson
Courses Plus Student 5,887 Pointstexture question!
Hello, I have a transparent texture, that i want to apply so its over my background image, but i cant figure out how to fix it, heres my code for the background
body {
height: 100%;
background: hsl(188, 74% , 21%); url("img/texture.png");
background: -webkit-linear-gradient(#0e535d , #8ce1ee);
background: -moz-linear-gradient(#0e535d , #8ce1ee);
background: -ms-linear-gradient(#0e535d , #8ce1ee);
background: -o-linear-gradient(#0e535d , #8ce1ee);
background: linear-gradient(#0e535d , #8ce1ee);
color: #FFFFFF;
line-height: 1.6;
}
1 Answer

Máté Végh
25,607 PointsHey,
Add this to your CSS:
html {
height: 100%;
}
Máté Végh
25,607 PointsMáté Végh
25,607 PointsAlso add a
margin: 0;
to the body. This will remove that line from the bottom of the page.erdragerdragsson
Courses Plus Student 5,887 Pointserdragerdragsson
Courses Plus Student 5,887 PointsWhen i add height: 100%; to my html, my header spans across half of the page,
and teh margin: 0; does not change anything
what line is at the bottom of the page?
Máté Végh
25,607 PointsMáté Végh
25,607 PointsCould you provide your full code?
To see what I'm talking about, comment out
margin: 0;
and scroll down here: http://codepen.io/anon/pen/LELrNrerdragerdragsson
Courses Plus Student 5,887 Pointserdragerdragsson
Courses Plus Student 5,887 Pointsthe bottom border is set at the bottom by me,
and by using the first code snippet, i posted , shouldnt the texture background work?
Máté Végh
25,607 PointsMáté Végh
25,607 PointsSorry! I didn't notice that your backgrounds aren't defined properly. You have to include both the image and the gradient on the fallback backgrounds too. When adding multiple backgrounds top layer comes first, bottom layer goes to the end. Also, they should be separated by a comma, not semicolon. Like this:
erdragerdragsson
Courses Plus Student 5,887 Pointserdragerdragsson
Courses Plus Student 5,887 Pointsthe texture still doesn't show up, i downloaded a texture from here http://www.transparenttextures.com/ (the Asfalt one)
and i put the transparent texture inside my img folder, but it still wont display
// erdrag
Máté Végh
25,607 PointsMáté Végh
25,607 PointsIt should be alright now because it works for me: http://codepen.io/anon/pen/EaXRvQ
What you can do:
Máté Végh
25,607 PointsMáté Végh
25,607 PointsIs your "img" folder on the same level as your CSS file?
If not, you will have to use another path that is relative to your CSS file. For instance, it's a common way to have an "img" and a "css" folder in the root. In that case, you would use this path: "../img/texture.png" – the double-dot notation goes back to the parent folder.
Hope this helps.
erdragerdragsson
Courses Plus Student 5,887 Pointserdragerdragsson
Courses Plus Student 5,887 Pointsit works when i use the url to the transparent site, but not when i use the url to my img folder, hmm thats wierd,
well thanks for helping ! :D
erdragerdragsson
Courses Plus Student 5,887 Pointserdragerdragsson
Courses Plus Student 5,887 Pointsyeah the double-dot notation fixed it!
now i have to find a cool texture to add :D
Máté Végh
25,607 PointsMáté Végh
25,607 PointsI'm glad I could help, good luck!