demosthenes.info

I’m Dudley Storey, the author of Pro CSS3 Animation. This is my blog, where I talk about web design and development with , and . To receive more information, including news, updates, and tips, you should follow me on Twitter.

featured articles

popular favourites

Introduction to Curved & Inset Drop Shadows With CSS3

A recent web design trend is to underscore container elements with a subtle drop shadow, often one that is inset and curved on the corners to provide a "lifted" visual effect: a good example would be the Effector theme for Tumblr by Carlo Franco. There are a number of ways to achieve this particular effect: over the next week I’ll proceed from the most basic to the advanced. All the methods shown will have the same requirements:

  • the effects must be fluid: the container must have the ability to resize, and any shadows should move with it.

  • the effects should use a minimum number of images, to gain maximum adaptability and speed.

  • The effects should be applied via CSS; no alteration to markup will be required.

Our markup will be the same for all examples: a series of simple HTML5 article elements with filler text:

  1. <article><p>Lorem ipsum dolor sit amet…</article>
  2. <article><p>Fusce iaculis feugiat ornare…</article>

The base CSS will also always be the same:

  1. body { background: #ffc; }
  2. article { box-sizing: border-box; padding: 1.6rem; width: 70%;
  3. margin: 2rem auto; border: 1px solid #bca; border-radius: 3px;
  4. background: #ffe;  }

I’ve applied a very small curve on the corners of each article with border-radius to soften them, and added a light border to visually separate each article from the background. I’ll be adding to this base CSS with each article in the series.

The methods we will use to create the drop shadows are:

You must be signed up in order to leave comments.

Dudley StoreyYou're welcome, Alaina! The different options will come in as articles that should be complete in a week.

posted by Dudley Storey

web developer guide

featured comment

by Aisling Brock in New Business Card Design

what i'm reading

A Feast for Crows: A Song of Ice and Fire: Book Four
A Feast for Crows: A Song of Ice and Fire: Book Four

what i'm watching

Prometheus: Collector's Edition (Bilingual) [Blu-ray 3D + Blu-ray + DVD + Digital Copy]
Prometheus: Collector's Edition (Bilingual) [Blu-ray 3D + Blu-ray + DVD + Digital Copy]

what i'm playing

Borderlands
Borderlands

what i'm hearing

Planets
Planets

blogs

podcasts

no ads ever

This blog is free of advertising, and always will be.

creative commons licensed

The content of this blog is free to use in whatever way you wish under the Creative Commons license.