Overview of the new features of CSS3: How to use CSS3 to achieve shadow effects
Introduction:
With the continuous development of CSS3, modern web designers can easily Pure CSS is used to achieve effects that were previously only possible through image technology. One of them is the shadow effect. This article will introduce the shadow properties of CSS3 and provide code examples to help you use CSS3 to achieve shadow effects.
CSS3 shadow property:
Through the box-shadow property of CSS3, we can add a shadow effect to HTML elements. This property allows us to specify the offset, blur, spread, and color of the shadow. The following is the syntax of the box-shadow attribute:
box-shadow: h-shadow v-shadow blur spread color;
where:
Example 1: Basic shadow effect
The following example shows how to add a basic shadow effect through the box-shadow property of CSS3:
<style> .box { width: 200px; height: 200px; background-color: #f5f5f5; box-shadow: 0px 0px 10px 5px rgba(0, 0, 0, 0.3); } </style>
<div class="box"> 这是一个带有阴影的盒子 </div>