How to use the background-origin attribute in css
This article mainly shows you "how to use the background-origin attribute in css", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to use the background-origin attribute in css" this article.
CSS3background-origin attribute
Function: specify the location area of the background picture.
Description: sets or retrieves the reference origin (location) when calculating the background image of an object.
Syntax:
Background-origin:padding-box | border-box | content-box
Padding-box: the background image is positioned relative to the inner margin box.
Border-box: the background image is positioned relative to the border box.
Content-box: the background image is positioned relative to the content box.
An example of using the CSS3background-origin attribute
Div
{
Border:1pxsolidblack
Padding:35px
Background-image:url ('https://img.php.cn/upload/article/000/000/024/5c513adf97e86533.jpg');
Background-repeat:no-repeat
Background-position:left
}
# div1
{
Background-origin:border-box
}
# div2
{
Background-origin:content-box
}
Background-origin:border-box:
This is the text. This is the text. This is the text. This is the text. This is the text. This is the text. This is the text. This is the text. This is the text. This is the text. This is the text. This is the text. This is the text. This is the text. This is the text. This is the text. This is the text. This is the text. This is the text. This is the text. This is the text. This is the text. This is the text. This is the text. This is the text. This is the text. This is the text. This is the text. This is the text. This is the text. This is the text. This is the text. This is the text. This is the text. This is the text. This is the text.
Background-origin:content-box:
This is the text. This is the text. This is the text. This is the text. This is the text. This is the text. This is the text. This is the text. This is the text. This is the text. This is the text. This is the text. This is the text. This is the text. This is the text. This is the text. This is the text. This is the text. This is the text. This is the text. This is the text. This is the text. This is the text. This is the text. This is the text. This is the text. This is the text. This is the text. This is the text. This is the text. This is the text. This is the text. This is the text. This is the text. This is the text. This is the text.
The above is all the content of the article "how to use the background-origin attribute in css". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!