スタイルpaddingBottomプロパティ
例
<div>要素の下部のパディングを設定します。
document.getElementById("myDiv").style.paddingBottom = "50px";
定義と使用法
paddingBottomプロパティは、要素の下部のパディングを設定または返します。
marginプロパティとpaddingプロパティはどちらも、要素の周囲にスペースを挿入します。ただし、違いは、マージンが境界線の周囲にスペースを挿入するのに対し、パディングは要素の境界線内にスペースを挿入することです。
ブラウザのサポート
Property | |||||
---|---|---|---|---|---|
paddingBottom | Yes | Yes | Yes | Yes | Yes |
構文
paddingBottomプロパティを返します。
object.style.paddingBottom
paddingBottomプロパティを設定します。
object.style.paddingBottom = "%|length|initial|inherit"
プロパティ値
Value | Description |
---|---|
% | Defines the bottom padding in % of the width of the parent element |
length | Defines the bottom padding in length units |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
技術的な詳細
デフォルト値: | 0 |
---|---|
戻り値: | 要素の下部のパディングを表す文字列 |
CSSバージョン | CSS1 |
その他の例
例
<div>要素の下部のパディングを「通常」に戻します。
document.getElementById("myDiv").style.paddingBottom = "0px";
例
<div>要素の下部のパディングを返します。
alert(document.getElementById("myDiv").style.paddingBottom);
例
marginBottomとpaddingBottomの違い:
function changeMargin() {
document.getElementById("myDiv").style.marginBottom = "100px";
}
function changePadding() {
document.getElementById("myDiv2").style.paddingBottom = "100px";
}
関連ページ
CSSチュートリアル:CSSパディング
CSSリファレンス:padding-bottomプロパティ
HTML DOMリファレンス:パディングプロパティ
❮スタイルオブジェクト