To give <div>
Add shadows to elements. You can use CSS box-shadow
Property. This attribute allows you to define one or more shadow effects.
The following is an example of how to give <div>
Add shadow to elements:
< div class = "shadow-box" > This is a shadowed < div > Element. </ div >
CSS:
.shadow-box { box-shadow : zero 2px 4px rgba ( zero , zero , zero , zero point two ); }
In the above example, we created a class named .shadow-box
Of <div>
Element and apply the style to the class.
Through on .shadow-box
Set in class box-shadow
Property, we define a shadow effect. box-shadow
Property accepts a series of parameters, including horizontal offset, vertical offset, blur radius, expansion radius, and color. In this example, we set the horizontal offset of the shadow to 0, the vertical offset to 2 pixels, the blur radius to 4 pixels, and use the RGBA color value to specify the color and transparency of the shadow.
You can adjust as needed box-shadow
Property to achieve different shadow effects. You can also add multiple shadow effects to the box-shadow
Property to create more complex shadow effects.