2

Is it possible to duplicate the shadow effect you see here: http://a.imagehost.org/0835/sample.png without any images and using only CSS?

Let me clarify.... look at the shadow, it's around the tab and the content block itself, not just a simple div tag...

Ben
  • 60,438
  • 111
  • 314
  • 488
  • 7
    Please don't clutter up the question with useless comments unless you have something to contribute – Ben Jan 13 '11 at 21:27

7 Answers7

4

Since your tab will most likely contain an anchor to make it clickable, I'd make the anchor a block element, give a background color, and increase the height to cover the bottom part of the shadow.

Here is a demo: http://jsfiddle.net/xFbfp/1/

methodofaction
  • 70,885
  • 21
  • 151
  • 164
1

try this:

#tab {
    -moz-box-shadow: 0px -10px 5px #888;
    -webkit-box-shadow: 0px -10px 5px #888;
    box-shadow: 0px -10px 5px #888;
    z-index: 1;
}
#content {
    -moz-box-shadow: 0px 0px 5px #888;
    -webkit-box-shadow: 0px 0px 5px #888;
    box-shadow: 0px 0px 5px #888;
    z-index: 0;
}

http://www.css3.info/preview/box-shadow/

mitch
  • 985
  • 10
  • 12
  • can't you apply this to two separate divs? One with drop shadow above, the main content box (under the tab) will have drop shadow beneath? – mitch Jan 13 '11 at 21:49
  • If the tab was on top of hte content area, the tab's shadow would still be visible between the tab and content area... – Ben Jan 13 '11 at 21:57
  • 1
    not if the drop shadow for the tab is above it (ie the dropshadow never appears below the tab). – mitch Jan 13 '11 at 23:01
0

Nope not that kind of 'faded' effect. You could do a solid shadow by playing about with some margins. But you would need a background image to get that faded effect.

OR

You could use CSS3 to do it which would go something like this:

#mydiv
{
   box-shadow: 10px 10px 5px #888;
} 
Chris
  • 3,191
  • 4
  • 22
  • 37
0

You need two boxes. One for the main one and one for the tab. The tab does not have a shadow on the bottom and must overlap the larger box to cover up that portion of its top shadow.

Diodeus - James MacFarlane
  • 112,730
  • 33
  • 157
  • 176
0

Only a idea...

If you use div´s: You can try to use z-index with the tab div and align it to the content div to cover the shadow (of content div)...

But the round corners are the problem between tab and content div...

Mika
  • 1,539
  • 15
  • 22
  • That would work, except I'm trying to get a shadow on the top of the content div as well without covering up the tab – Ben Jan 13 '11 at 21:31
0

Creating a CSS3 box-shadow on all sides but one has useful info on how to sort out the various box-shadow issues.

Community
  • 1
  • 1
andreasbovens
  • 1,447
  • 12
  • 11
0

Well this is two absolutely positioned divs, with the tab div z-indexed on top of the content div. You just set a -y 3px offset for the tab shadow and a 3 pixel blur and you're good to go. From playing around with it, you kind of need to use rgba, with a .5 alpha value in order to get the proper shadow effect.

alt text

Michael Mullany
  • 30,283
  • 6
  • 81
  • 105