CSS · CSS Advanced · Lesson 44
CSS Shadows
text-shadow and box-shadow.
With CSS you can add shadows to text and to elements.
Example
<style>
h1 { text-shadow: 2px 2px 5px rgba(0,0,0,.4); }
h2.neon { color: white; text-shadow: 0 0 6px #04AA6D, 0 0 12px #04AA6D; background: #111; padding: 6px; }
.card { width: 240px; padding: 20px; border-radius: 10px; box-shadow: 0 4px 12px rgba(0,0,0,.2); font-family: Arial; }
</style>
<h1>Text shadow</h1>
<h2 class="neon">Neon glow</h2>
<div class="card">A card with a box-shadow</div>
The values are: horizontal offset, vertical offset, blur radius, (spread for box-shadow), and color. Add inset for an inner shadow.
Keep reading “CSS Shadows”
Sign up to read the full lesson, try every example in the live editor, and take the 5-question quiz.