In its basic application, you define a horizontal and a vertical shadow. The default shadow color is the current text color.
Example
Define a horizontal and a vertical shadow.
div { box-shadow: 10px 10px; } |
The color parameter specifies the shadow’s color.
Example
Define a color for the shadow.
div { box-shadow: 10px 10px lightblue; } |
The blur parameter determines the extent of blur radius. Increasing the number results in a more blurred shadow effect.
Example
Incorporate a blur effect into the shadow.
div { box-shadow: 10px 10px 5px lightblue; } |
The spread parameter specifies the spread radius. Positive values expand the shadow’s size, while negative values reduce it.
Example
Adjust the spread radius of the shadow:
div { box-shadow: 10px 10px 5px 12px lightblue; } |
By incorporating the inset parameter, you can transform the shadow from an outer shadow (outset) to an inner shadow.
Example
Include the inset parameter.
div { |
div { box-shadow: 5px 5px blue, 10px 10px red, 15px 15px green; } |
The box-shadow property can also be utilized to design paper-like cards.
Example
div.card { width: 250px; box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); text-align: center; } |