CSS shadow Effect
CSS Shadow Effects
In these chapters you will learn about the following properties:
text-shadow
box-shadow
CSS Text Shadow
The CSS text-shadow property applies shadow to text.
In its simplest use, you only specify the horizontal shadow (2px) and the vertical shadow (2px) and go further to specify the color and add a blur to it.
<!DOCTYPE html>
<html>
<head>
<title>CSS Text Effect</title>
<style>
p{
width:120px;
border:1px solid;
}
.word1 {
white-space: nowrap;
overflow: hidden;
text-overflow: clip;
}
.word2 {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.word3 {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.word3:hover {
overflow: visible;
}
</style>
</head>
<body>
<div>
<h2>Text Overflow</h2>
<p class="word1">Lorem ipsum dolor sit amet,
consectetur adipisicing elit. Totam corrupti.</p>
<p class="word2">Lorem ipsum dolor sit amet,
consectetur adipisicing elit. dolore. Iaquenmdm.</p>
<p class="word3"> elit. Totam corrupti, aliquam perspiciatis
sint est quae debitisgdg libero.</p>
</div>
</body>
</html>
Multiple Shadows
To add more than one shadow to the text, you can add a comma-separated list of shadows. The following example shows a red and blue neon glow shadow:
<!DOCTYPE html>
<html>
<head>
<title>CSS Text Shadow Effect</title>
<style>
p{
font-size:30px;
color: white;
text-shadow: 1px 1px 2px black, 0 0 25px blue, 0 0 5px darkblue;
}
</style>
</head>
<body>
<div>
<h2>Text Shadow</h2>
<p>Lorem ipsum dolor</p>
</div>
</body>
</html>