📅  最后修改于: 2023-12-03 14:59:34.198000             🧑  作者: Mango
CSS box-shadow property is used to create a shadow effect around an element.
Syntax:
box-shadow: h-shadow v-shadow blur spread color inset;
Example:
.box {
box-shadow: 2px 2px 5px 2px rgba(0, 0, 0, 0.3);
}
Box Shadow can be used to create various effects like flat, deep, long, multiple, 3D, animated etc.
.box {
box-shadow: 2px 2px 5px 2px rgba(0, 0, 0, 0.3);
}
.box {
box-shadow: 4px 4px 8px 0 rgba(0, 0, 0, 0.4),
0 0 10px 2px rgba(0, 0, 0, 0.3);
}
.box {
box-shadow: 8px 8px 0 0 #008CBA;
}
.box {
box-shadow: 0 0 0 10px #5C5C5C,
0 0 0 15px #444444,
0 0 0 20px #2E2E2E,
0 0 0 25px #000000;
}
.box {
box-shadow: 0 0 0 10px rgba(0, 0, 0, 0.2),
0 0 20px 5px rgba(0, 0, 0, 0.2),
0 0 30px 10px rgba(0, 0, 0, 0.2);
}
.box {
animation: shadow-pulse 10s infinite;
}
@keyframes shadow-pulse {
0% {
box-shadow: 0 0 0 0px rgba(0, 168, 255, 0.7);
}
50% {
box-shadow: 0 0 0 25px rgba(0, 168, 255, 0);
}
100% {
box-shadow: 0 0 0 0 rgba(0, 168, 255, 0.7);
}
}
Box Shadow is a very useful and creative property in CSS to give a great look and feel to the webpage elements.