Jump to content

Html-Css, Layering Backgrounds Question


npl

Recommended Posts

Hey,

 

I want to have 3 background images layered on each other. It should look like the image below.

 

 

So I want the outline of the mountains on the top of the background.

A white layer beneath it that sticks out about half an inch on each side.

A grid which would be set to repeat behind that.

 

It should be like layers in photoshop.

 

Just note I don't want to do all this in one image. Loading a giant image as a background will kill my bandwidth and speed. If the grid, the largest part of the background is set to "repeat" it will take less time and bandwidth to load.

 

Can you guys help me out with the code. I know some html and css to do this. However it is only very basic knowledge learn't from http://www.w3schools.com/

 

Thanks for the help!

Nolan,

 

Link to comment
Share on other sites

You should be able to use the z-index property to do this. For example, you would have three divs with top:0, left:0, height:100%, and width:100%. However, their z-index properties would be different, so you could layer them.

Link to comment
Share on other sites

Ahh I wish I understood what that means. I have verrrrry basic knowledge of CSS and HTML. lol I just began learning less then a year ago.

 

Is there any chance you could just show me the code and what to insert where? That would be awesome and save me a lot of grief.

 

Thanks! :D

Link to comment
Share on other sites

It is wordpress. And the theme I got is very similar to the image. Its called Canvas by Woothemes http://www.woothemes.com/2011/05/canvas/.The only thing I changed was the backgrounds and a few of the graphics.

 

All I need to do know is take the changes that I made in PS and translate them to code. Any chance you could help me by posting what I should do if you do not mind?

Link to comment
Share on other sites

Actually, @vol7ron's approach was better than mine. The code for his approach would look like this:

 

<style type="text/css">
.background-div {
  padding: 0;
  margin: 0;
}
</style>
<div class="background-div" style="background-image:url('image.gif')">
<div class="background-div" style="background-image:url('image2.gif')">
<div class="background-div" style="background-image:url('image3.gif')">

Content in here has all three backgrounds!
</div>
</div>
</div>

 

Of course, the images will need to be transparent for this to work, or you can make them transparent with CSS, as @vol7ron said.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...