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 | 背景图像的相对位置的内容框 | 
内容框相对定位的背景图片:
div
{
background-image:url('smiley.gif');
background-repeat:no-repeat;
background-position:left;
background-origin:content-box;
}
表格中的数字表示支持该属性的第一个浏览器版本号。
| Property | |||||
|---|---|---|---|---|---|
| background-origin | 4.0 | 9.0 | 4.0 | 3.0 | 10.5 | 
CSS3 教程: CSS3 Backgrounds
备案信息: 粤ICP备15087711号-2
Copyright © 2008-2025 啊嘎哇在线工具箱 All Rights.
本站所有资料来源于网络,版权归原作者所有,仅作学习交流使用,如不慎侵犯了您的权利,请联系我们。