Bronzato
Bronzato

Reputation: 9342

Having a shadow on my sidebar

I have a right sidebar on my page and I would like to have a shadow on the left side of this sidebar. A very light shadow like the one showed on the Google Maps left sidebar ( http://maps.google.be). Is it possible?

Here is a jsFiddle to have an idea: http://jsfiddle.net/yhfXX/3/

Normally the sidebar should take the full height but this jsFiddle is just an example.

Thanks

Upvotes: 3

Views: 14668

Answers (4)

Pawel
Pawel

Reputation: 434

You can use CSS for that, like so:

text-shadow: 0px 3px 2px rgba(0, 0, 0, 0.5);

experiment with it to find the best setup for you =)

Upvotes: 0

seipsum
seipsum

Reputation: 11

This is not supported from w3c:

.shadow {
   **-moz-box-shadow:    inset 0 0 10px #000000;**
   **-webkit-box-shadow: inset 0 0 10px #000000;**
   box-shadow:         inset 0 0 10px #000000;
}

Upvotes: 0

machineaddict
machineaddict

Reputation: 3236

that's the css3 inset shadow:

.shadow {
   -moz-box-shadow:    inset 0 0 10px #000000;
   -webkit-box-shadow: inset 0 0 10px #000000;
   box-shadow:         inset 0 0 10px #000000;
}

adjust the 10px to your need

Upvotes: 0

Didier Ghys
Didier Ghys

Reputation: 30666

You use the box-shadow css rule to create a drop shadow.

#sidebar {
  -moz-box-shadow:    -3px 0 5px 0 #555;
  -webkit-box-shadow: -3px 0 5px 0 #555;
  box-shadow:         -3px 0 5px 0 #555;
}

DEMO

The use is:

  1. The horizontal offset of the shadow, positive means the shadow will be on the right of the box, a negative offset will put the shadow on the left of the box.
  2. The vertical offset of the shadow, a negative one means the box-shadow will be above the box, a positive one means the shadow will be below the box.
  3. The blur radius (optional), if set to 0 the shadow will be sharp, the higher the number, the more blurred it will be.
  4. The spread radius (optional), positive values increase the size of the shadow, negative values decrease the size. Default is 0 (the shadow is same size as blur).
  5. Color

Box-shadow support table

Upvotes: 12

Related Questions