Eureka Moment Wiki

One eureka moment at the time

User Tools

Site Tools


development:css:box_shadow

Box shadow

Adding a simple shadow to any rectangle shaped object is quite easy. Here is how to do it cross-browser.

.shadow {
-moz-box-shadow: 3px 3px 5px 6px #ccc;
-webkit-box-shadow: 3px 3px 5px 6px #ccc;
box-shadow: 3px 3px 5px 6px #ccc;
}
  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
  6. You can put 'inset' after the color definition to make the shadow an inner shadow
development/css/box_shadow.txt · Last modified: 2017/12/12 10:04 by tplecko