Two-Color Three-Dimensional Blocks and Text

Chris Coyier on

We can use multiple text-shadow and box-shadow values to create a three-dimensional look to blocks or text, like this screenshot of David DeSandro’s footer. However in that example, the “three dimesional” part is a solid color.

By alternating colors back and forth in the “stacking order” of our box or text shadow declaration, we can simulate a more three dimensional / lighted effect.

text-shadow: 1px 0px #eee, 0px 1px #ccc, 2px 1px #eee, 1px 2px #ccc, 3px 2px #eee, 2px 3px #ccc, 4px 3px #eee, 3px 4px #ccc, 5px 4px #eee, 4px 5px #ccc, 6px 5px #eee, 5px 6px #ccc, 7px 6px #eee, 6px 7px #ccc, 8px 7px #eee, 7px 8px #ccc, 8px 8px #eee;

Example