I set the body to:
body { background-image: url(file:///Volumes/HDD/photomadness_remixed/css/Flavours_400812054.jp2);
background-attachment: fixed;
background-position: center;
background-size: cover;
z-index: 0;}
and it displays my background but when i set this code:
body {
z-index: -1;
background: #425b77; }
#myBody {
background-image: url(file:///Volumes/HDD/photomadness_remixed/css/Flavours_400812054.jp2);
background-attachment: fixed;
background-position: center;
background-size: cover;
z-index: 0;
}
it just would not display the background and instead just displaying the color i set on the body tag. Any idea how to solve this?
Edit: When i look at this code on another webpage i have it works correctly and i have written the exakt same thing.
This is my result from code at the second line: https://www.dropbox.com/s/ioo1cnfszdzh0wu/Skärmavbild%202014-03-07%20kl.%20184433.png?m=
This is the result i get from the code at line 8 and downwards: http://www.dropbox.com/s/d8wjnwt346gzdv3/Skärmavbild%202014-03-07%20kl.%20184402.png?m=
Edit:
If i add content inside the <div id="myBody"></div> then it will be blurred too because i want a blur filter on it.
-
please post your HTML or better yet a fiddleceleriko– celeriko2014年03月07日 17:41:34 +00:00Commented Mar 7, 2014 at 17:41
-
bit of a guess ./Flavours_400812054.jp2Millard– Millard2014年03月07日 17:41:43 +00:00Commented Mar 7, 2014 at 17:41
2 Answers 2
try this :
body {
background: #425b77; }
#myBody {
background:url(your picture) no-repeat center center scroll;
background-size: cover;
-moz-background-size: cover;
width:50%; height:50%;
display:block;
position:fixed;
z-index:1001;
}
this is just example... change position width and height as you wish
4 Comments
top: 0px and the left: 0px to the style!z-index won't co-operate with me now.z-index in body... is it necessary z-index in body?z-index on the bodyYou forgot to add Height and Width (or add the content do that div).