Background-clip Properties in CSS

Source: Internet
Author: User
This article mainly introduces the function of the Background-clip attribute in CSS, and the popular function of the Background-clip attribute is to specify the area of the element background, and to take a look at the related knowledge of Background-clip property in CSS. Hope to help everyone.

The popular function of the Background-clip attribute is to specify the area where the element background is located, with four kinds of values

1, Border-box

Border-box is the default value that indicates that the background of the element is preserved from within the border area (including border).

The simple code is as follows:


<!doctype html>

The effect is as follows:

  

As we can see, the element background is the default in the border and within the area, but do not know why the background image is not covered, and the background color is not the problem.

2, Padding-box

Padding-box indicates that the background of the element is preserved from within the padding area (including padding).

The simple code is as follows:


<!doctype html>

The effect is as follows:

We can see that the background image exists in padding and within the area.

3, Content-box

Content-box indicates that the background of the element is preserved from within the content area.

The simple code is as follows:


<!doctype html>

The effect is as follows:

We can see that the background image exists within the content area.

4. Text

Content-box indicates that the background of the element remains in the foreground content (text), and its shape is the same size, currently only supported by Chrome browser

The simple code is as follows:


<!doctype html>

The effect is as follows:

Description: When the current value is text, compatibility is very poor, only know.

Related Article

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.