CSS3 background-originプロパティ
例
コンテンツボックスに相対配置された背景画像:
div
{
background-image:url('smiley.gif');
background-repeat:no-repeat;
background-position:left;
background-origin:content-box;
}
{
background-image:url('smiley.gif');
background-repeat:no-repeat;
background-position:left;
background-origin:content-box;
}
試してみる »
ブラウザサポート
表内の数字は、そのプロパティをサポートする最初のブラウザバージョン番号を示します。
| プロパティ | |||||
|---|---|---|---|---|---|
| background-origin | 4.0 | 9.0 | 4.0 | 3.0 | 10.5 |
タグの定義と使用説明
background-origin プロパティは、background-position プロパティの相対位置を指定します。
注意背景画像の background-attachment が "fixed" の場合、このプロパティは効果がありません。
| デフォルト値: | 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
その他の拡張