スタイルbackgroundOriginプロパティ
例
コンテンツボックスを基準にして背景画像を配置します。
document.getElementById("myDIV").style.backgroundOrigin = "content-box";
定義と使用法
backgroundOriginプロパティは、background-positionプロパティが相対的なものを設定または返します。
注:背景画像のbackground-attachmentプロパティが「固定」されている場合、このプロパティは効果がありません。
ブラウザのサポート
表の数字は、プロパティを完全にサポートする最初のブラウザバージョンを示しています。
Property | |||||
---|---|---|---|---|---|
backgroundOrigin | 4.0 | 9.0 | 4.0 | 3.0 | 10.5 |
構文
backgroundOriginプロパティを返します。
object.style.backgroundOrigin
backgroundOriginプロパティを設定します。
object.style.backgroundOrigin = "padding-box|border-box|content-box|initial|inherit"
プロパティ値
Value | Description |
---|---|
padding-box | Default value. 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 |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
技術的な詳細
デフォルト値: | パディングボックス |
---|---|
戻り値: | 要素のbackground-originプロパティを表す文字列 |
CSSバージョン | CSS3 |
関連ページ
CSSリファレンス:background-originプロパティ