Home  >  Article  >  Web Front-end  >  How to use css background-origin attribute

How to use css background-origin attribute

藏色散人
藏色散人Original
2019-05-29 10:41:583484browse

css background-origin attribute The background-origin attribute is used to set the positioning area of ​​the background image. Syntax: background-origin: padding-box|border-box|content-box; The three attribute values ​​represent respectively: positioning relative to the padding box, positioning relative to the border box, and positioning relative to the content box.

How to use css background-origin attribute

How to use the css background-origin attribute?

Function: Specifies the position relative to which the background-position attribute is positioned.

Syntax:

background-origin: padding-box|border-box|content-box;

Description: padding-box The background image is positioned relative to the padding 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.​

Note: If the background-attachment attribute of the background image is "fixed", this attribute has no effect.

css background-origin property usage example







background-origin:border-box:

这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。

background-origin:content-box:

这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。

Effect output:

How to use css background-origin attribute

The above is the detailed content of How to use css background-origin attribute. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn