Jump to content

[SOLVED] Container shadows


Andy17

Recommended Posts

Hello,

 

 

I would like to have shadows around my containers, but they are currently placed all the way to the left+right (understandably if you look at my code). I would, however, like to place them right next to my containers. Here is a preview so you can see what I mean:

 

http://test.jokeheaven.eu/shadows/

 

And below is my code.

 

 

HTML:

 

<div id="shadow-left"><div id="shadow-right">

<div id="banner">.</div>

<div id="menu">.</div>

<div id="content">.</div>

<div id="footer">.</div>

</div></div>

 

CSS:

 

body {
margin:0;
padding:0;
background-color:#cccccc;
}

#banner {
width:800px;
height:125px;
background-color:red;
margin: 0 auto;
}

#menu {
width:800px;
height:30px;
background-color:green;
margin: 0 auto;
}

#content {
width:800px;
height:500px;
background-color:blue;
margin: 0 auto;
}

#footer {
width:800px;
height:75px;
background-color:orange;
margin: 0 auto;
}

#shadow-left, #shadow-right {
margin: 0 auto;
}

#shadow-left {
background: url(images/shadow-left.png) left repeat-y;
}

#shadow-right {
background: url(images/shadow-right.png) right repeat-y;
}

 

Thank you in advance!

Link to comment
Share on other sites

"I would like to have shadows around my containers, but they are currently placed all the way to the left+right (understandably if you look at my code). I would, however, like to place them right next to my containers."

 

I didn't think that I had to ask "how do I do this?", but how would I do that?

Link to comment
Share on other sites

  • 2 weeks later...

Personally, id create a container to hold all your divs in and scrap your shadow css, ID make the container 860px (based on the presumption your shadows are 30px wide each). Id then make a backgroundin photoshop 860 wide with the shadows either side and then use this as the background for your container div and repeat it vertically, I hope this makes sense, and this is just my way of going about it..

Link to comment
Share on other sites

Thanks guys, I got it to work without the variable width. I figured I would just make the width percentages instead, but that created another problem; since my containers are wrapped inside the shadow divs (I'm not sure how to explain this since I'm rather new to CSS, but hopefully I will manage), then if I put width 80% in the content container, for example, it will be 80% of the shadow div's width if I understand it correctly.

 

Like if I want all my containers to be width 80%, then I am unsure how to make the shadows fit. At first I figured I'd just give it a percentage as width, but that didn't seem to work very well.

 

I apologize if I seem completely noobish, lol.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.