How to Create Inset Text with CSS3

This often gets confused with “How to Create Indented Text with CSS3” which is completely different. Indent, to me at least, means an indented paragraph. If that’s what you’re here looking for, I won’t leave you hanging, it’s:

p{text-indent:20px}

What I’m referring to, is my new favorite CSS3 technique:

Hello, how are you today?
VS
Hello, how are you today?

The difference isn’t dramatic, but it’s the subtleties that really bring a design together. Note: If you don’t see any difference at all, that means your browser does not support this CSS3 feature.

We could of course go a little more dramatic:

Hello, how are you today?

It really all depends on your color scheme and the contrast between the background color, font color, and shadow color. I’d only recommend using this technique on headers, info boxes, your copyright line, etc., but not on your content (main readable text area).

CSS

.inset{text-shadow:0 1px 0 #fff}

HTML

<div class="inset">Hello, how are you today?</div>