La propiedad text-shadow
agrega sombra al texto.
En su uso más simple, solo especificas la sombra horizontal (2px) y la sombra vertical (2px):
h1
{
text-shadow: 2px 2px;
}
Pruébelo usted mismo →
<!DOCTYPE html>
<html>
<head>
<style>
h1 {
text-shadow: 2px 2px;
}
</style>
</head>
<body>
<h1>Text-shadow effect!</h1>
</body>
</html>
Luego, agrega un color (rojo) a la sombra:
h1
{
text-shadow: 2px 2px red;
}
Pruébelo usted mismo →
<!DOCTYPE html>
<html>
<head>
<style>
h1 {
text-shadow: 2px 2px red;
}
</style>
</head>
<body>
<h1>Text-shadow effect!</h1>
</body>
</html>
Luego, agrega un efecto de desenfoque (5px) a la sombra:
h1
{
text-shadow: 2px 2px 5px red;
}
Pruébelo usted mismo →
<!DOCTYPE html>
<html>
<head>
<style>
h1 {
text-shadow: 2px 2px 5px red;
}
</style>
</head>
<body>
<h1>Text-shadow effect!</h1>
</body>
</html>
Sombra de texto sobre un texto blanco:
h1 {
color: white;
text-shadow: 2px 2px 4px #000000;
}
Pruébelo usted mismo →
<!DOCTYPE html>
<html>
<head>
<style>
h1 {
color: white;
text-shadow: 2px 2px 4px #000000;
}
</style>
</head>
<body>
<h1>Text-shadow effect!</h1>
</body>
</html>
Sombra de texto con brillo de neón rojo:
h1 {
text-shadow: 0 0 3px #ff0000;
}
Pruébelo usted mismo →
<!DOCTYPE html>
<html>
<head>
<style>
h1 {
text-shadow: 0 0 3px #FF0000;
}
</style>
</head>
<body>
<h1>Text-shadow with red neon glow!</h1>
</body>
</html>
Sombra de texto con brillo de neón rojo y azul:
h1 {
text-shadow: 0 0 3px #ff0000, 0 0 5px #0000ff;
}
Pruébelo usted mismo →
<!DOCTYPE html>
<html>
<head>
<style>
h1 {
text-shadow: 0 0 3px #FF0000, 0 0 5px #0000FF;
}
</style>
</head>
<body>
<h1>Text-shadow with red and blue neon glow!</h1>
</body>
</html>
h1 {
color: white;
text-shadow: 1px 1px 2px black, 0 0 25px blue, 0
0 5px darkblue;
}
Pruébelo usted mismo →
<!DOCTYPE html>
<html>
<head>
<style>
h1 {
color: white;
text-shadow: 1px 1px 2px black, 0 0 25px blue, 0 0 5px darkblue;
}
</style>
</head>
<body>
<h1>Text-shadow effect!</h1>
</body>
</html>
Consejo: Vaya a nuestro capítulo Fuentes CSS para aprender cómo cambiar las fuentes, el tamaño del texto y el estilo de un texto.
Consejo: Vaya a nuestro capítulo Efectos de texto CSS para conocer los diferentes efectos de texto.
Especifica el efecto de sombra agregado al texto.