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.