CSS: Easy to do?

Soldato
Joined
5 Mar 2003
Posts
10,771
Location
Nottingham
I'm messing around with a personal site and when I apply a css class to a div I want it to look like this:
2apx1g.png


Now I know I could fix the size of the divs and have numerous background images to fit that, but it seems a bit 'wrong'. Is there a way to do it with CSS?

I was thinking maybe have the drop shadow as a back ground image, the filtering done via CSS (as seen here: http://css3please.com/), but not sure how I'd do the top section and bottom section (i.e. no drop shadow on the top, drop shadow all along the bottom).

Thanks in advance!
 
two divs

first div has a repeating background which is the full width and shadow either side.
bottom div is the same width but going from the bottom up on the image you provided, it would be about 40px high.

If you have the first div using a repeating background the div can be a variable height dependant on content
 
^^ This, ish.

www.rghjones.co.uk/files/boxtop.png
www.rghjones.co.uk/files/boxcontent.png
www.rghjones.co.uk/files/boxbottom.png

<div class="boxtop">&nbsp;</div>
<div class="boxcontent">Content here</div>
<div class="boxbottom">&nbsp;</div>

.boxtop {
background:url(boxtop.png) no-repeat;
width:499px;
height:32px;
}

.boxcontent {
background:url(boxcontent.png) repeat-y;
width:499px;
height:auto;
}

.boxbottom {
background:url(boxbottom.png) no-repeat;
width:499px;
height:39px;
}

Not tested but that's the jist of it. Pretty simply really.
 
Last edited:
Thanks guys (and thanks for even slicing the image up - appreciated!)

Was hoping there was some way around having to create extra divs, but it's not a massive deal and gives the required effect.

Thanks.
 
Back
Top Bottom