AdBlock Detected!
Our website is made possible by displaying ads to our visitors. Please supporting us by whitelisting our website.
CSS box-shadow Property |
The box-shadow property in CSS allows web designers to add shadow effects to box elements, thus giving the element a more three-dimensional look and feel. This property is introduced as part of the CSS3 standard, and is supported by all the major browsers today. The syntax for box-shadow is as follows:
Note that the order of the values is important. For example, offset-x always occurs before offset-y, and blur-radius always occurs before spread-radius. Example 1 CSS declaration:
The following HTML,
renders, Box-shadow property example 1.
Notice the box shadow extends to the right of the box element by 5px and below the box element by 5px. Example 2: Negative offset values CSS declaration:
The following HTML,
renders, Box-shadow property example 2.
Notice the box shadow extends to the left of the box element by 10px and above the box element by 10px. Example 3: Inner Shadow (Inset) CSS declaration:
The following HTML,
renders, Box-shadow property example 3.
Notice the box shadow is inside of the box because of the inset declaration. This is called an inner shadow. It extends 10px to the right from the left border of the box element and extends 10px below the top border of the box element. Also notice the shadow color is now red. Example 4: Blur radius CSS declaration:
The following HTML,
renders, Box-shadow property example 4.
Notice that by setting blur-radius to 10px, now the shadow is blurry and no longer sharp. Example 5: Spread radius CSS declaration:
The following HTML,
renders, Box-shadow property example 5.
Notice that by setting spread-radius to 5px, the shadow extends further than Example 4. Example 6: Multiple shadows CSS declaration:
The following HTML,
renders, Box-shadow property example 6.
Notice the presence of two shadows, one to the upper-left of the box element, and the other to the lower-right of the box element. |
Our website is made possible by displaying ads to our visitors. Please supporting us by whitelisting our website.