0

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.

asked Mar 7, 2014 at 17:38
2
  • please post your HTML or better yet a fiddle Commented Mar 7, 2014 at 17:41
  • bit of a guess ./Flavours_400812054.jp2 Commented Mar 7, 2014 at 17:41

2 Answers 2

1

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

answered Mar 7, 2014 at 17:53
Sign up to request clarification or add additional context in comments.

4 Comments

This is still not over the entire page with the blur effect and i try to position it over the page but it is just giving me a little blue border of the color i put to the body Edit: It worked, i just had to put the top: 0px and the left: 0px to the style!
This was even better... My z-index won't co-operate with me now.
pff :) ... try to remove z-index in body... is it necessary z-index in body?
I do never use the z-index on the body
0

You forgot to add Height and Width (or add the content do that div).

answered Mar 7, 2014 at 17:48

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.