CSS3 add a shadow to div or text (Use of Box shadow, text Shadow)

Source: Internet
Author: User

CSS3 defines two kinds of shadows: Box Shadows and Text shadows. Where the box shadow needs to be IE9 and its newer version, and the text shadow needs IE10 and its newer version. The following are the uses of two shades:

1, Box Shadow

(1) The property of the box shadow is Box-shadow


box-shadow:5px 5px 10px Gray;

The first two values represent the horizontal and vertical offset of the shadow.

The third value indicates a fuzzy distance. The last value is the shadow color.

(2) Box shadow can be changed automatically with the shape of the box


(3) If there is content underneath the box, you can use the RGBA () function to set the shadow color to translucent


box-shadow:5px 5px 10px Rgba (0,0,0,0.5);

(4) Stretching range setting
After the blur distance, you can also add a value that represents the stretch range (spread). The solid color area used to increase the blur boundary.

The following yesterday is not set stretch range, the right figure set:


box-shadow:5px 5px 10px 5px Gray;

(5) Add inset behind the color to create the inner shadow


box-shadow:5px 5px 10px Gray inset;

2, Text Shadow

The property of the text shadow is Text-shadow. The order of values differs from the box shadow by specifying the color, followed by the horizontal and vertical offsets, and then the fuzzy values.


Text-shadow:gray 10px 10px 7px;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.