Shadow Boxing
This isn’t revolutionary, but making simple boxes with shadows can be really easy with a little simple CSS. The other day I wanted to make a really simple box with a shadow. Adding gray borders kind of does the trick, but you lose the nice hatches out of the corners that indicate depth. Then it dawned on me that using relative positioning, you could easily make a nice shadow. Here's how you can do it.
In your style sheet add the following two classes:
.shadowbox {
background: #ccc;
position: relative;
top: 2px;
left: 2px;
}
.shadowbox div {
background: #333;
border: 2px solid #000;
color: #fff;
padding: 10px;
position: relative;
top: -2px;
left: -2px;
}
Then simply code your box:
<div class="shadowbox">
<div>And there you have your result!</div>
</div>
Of course, you can change the background colours and borders as you wish and by adding a width to the shadowbox class you can control the width of the whole thing. Have fun shadow boxing.
I did the same thing, but using an image:
http://www.1976design.com/blog/archive/2003/11/14/shadows/
A few other people came up with the same idea around the same time.
Sadly, the transparency _doesn't_ work in IE (it uses the correct base color of the image, however) so you'll need Mozilla (http://www.mozilla.org/) or Safari (Mac only) to see the full effect.
.shadowbox > div {
you can have additional div's inside the shadow box...
(This is written of the top of my head, I may be wrong.)
A minor tweak, this:
To make it look more as if the shadow has a blurred edge, just add a slightly lighter border to the .shadowbox class.
This way, you get a content box with a two-colour shadow.
Enjoy.
My code:
.shadowbox {
background: #dfdfdf;
border: 1px solid #f5f5f5;
position: relative;
top: 3px;
left: 3px;
}
.shadowbox div {
background: #fff;
border: 1px solid #000;
color: #ff0000;
padding: 5px 10px;
position: relative;
top: -3px;
left: -3px;
}
Thanks, any help is appreciated.
Arun.


