background-origin

本页内容

CSS3 background-origin 属性

内容框相对定位的背景图片:


示例

div

    {

    background-image:url('smiley.gif');

    background-repeat:no-repeat;

    background-position:left;

    background-origin:content-box;

    }

浏览器支持

表格中的数字表示支持该属性的第一个浏览器版本号。

属性 Chrome Internet Explorer / Edge Firefox Safari Opera
background-origin 4.0 9.0 4.0 3.0 10.5

标签定义及使用说明

background-Origin属性指定background-position属性应该是相对位置。

注意如果背景图像background-attachment是"固定",这个属性没有任何效果。

默认值: padding-box
继承: no
版本: CSS3
JavaScript 语法: object object.style.backgroundOrigin="content-box"

语法

background-origin: padding-box|border-box|content-box;
描述
padding-box 背景图像填充框的相对位置
border-box 背景图像边界框的相对位置
content-box 背景图像的相对位置的内容框

相关文章

CSS3 教程: CSS3 Backgrounds

此页面最后编辑于2022年8月19日 (星期五) 04:43。