Repeating background vertical image with top padding?
I have a container 969px wide that should have left and right shadow images (each 27px wide for a total container width of 1023px).
My problem is that I don't want the shadows on the left and right to start until about 30pixels down from the top of the container.
My guess is that I need to create another container 30px down just for the shadows.
But I'm wondering if I could use the shadows on the entire container and add top padding to the shadow images, but not add top padding to the container itself? Is there a way to do this? I suspect there is and I'm making it harder, but I wanted to throw it out there for the masses.
Why didn't you just try it? Without code I'm guessing, but yes using top padding OR top margin on the two shadows will force them to start further down than the container.
Why didn't you just try it? Without code I'm guessing, but yes using top padding OR top margin on the two shadows will force them to start further down than the container.
I tried it and unfortunately it pushed down the container as well, not just the shadows. Perhaps setting up the other container is the only way?
Hello loamguy1,
If your shadow is an actual image that you using as a background you can easily position that. If your shadow is CSS created, neither margin or padding will move it down.
Hello loamguy1,
If your shadow is an actual image that you using as a background you can easily position that. If your shadow is CSS created, neither margin or padding will move it down.
It's a lot easier if you post your entire code so we don't have to guess what you're doing with your markup. That CSS seems to work, with a few changes...
Code:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<style type="text/css">
body {background: #fff url(img/msw-site-bg-notopblack.jpg) no-repeat fixed center top;}
#shadow-container {
width: 1022px;
margin: 0 auto;
background: url(img/BackgroundShadow_right.png) repeat-y right top;
}
#shadow-border-left {background: #0f0 url(img/BackgroundShadow_Left.png) repeat-y left top;}
#main-container {
width: 968px;
margin: 140px auto;
background: #ccc;
}
#top {
height: 140px;
width: 968px;
margin: 0 0 0 -484px;
position: fixed;
top: 0px;
left: 50%;
z-index: 1;
background: #f00;
}
</style>
</head>
<body>
<div id="top"></div>
<div id="shadow-container">
<div id="shadow-border-left">
<div id="main-container">
<p>
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna
aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no
sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam
nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo
duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
</p>
<!--end main-containner--></div>
<!--end shadow-border-left--></div>
<!--end shadow-container--></div>
</body>
</html>