From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/ja/web/css/padding/index.html | 169 ++++++++++++++++++++++++++++++++++++ 1 file changed, 169 insertions(+) create mode 100644 files/ja/web/css/padding/index.html (limited to 'files/ja/web/css/padding') diff --git a/files/ja/web/css/padding/index.html b/files/ja/web/css/padding/index.html new file mode 100644 index 0000000000..017db4e7c2 --- /dev/null +++ b/files/ja/web/css/padding/index.html @@ -0,0 +1,169 @@ +--- +title: padding +slug: Web/CSS/padding +tags: + - CSS + - CSS Padding + - CSS Property + - Reference + - 'recipe:css-shorthand-property' +translation_of: Web/CSS/padding +--- +
{{CSSRef}}
+ +

paddingCSS一括指定プロパティで、要素の全四辺のパディング領域を一度に設定します。

+ +
{{EmbedInteractiveExample("pages/css/padding.html")}}
+ + + +

要素のパディング領域とは、コンテンツと境界線の間の領域のことです。

+ +
+

注: パディングは要素の内部に追加の領域を作成します。それに対して、 {{cssxref("margin")}} は要素の周りに追加の領域を作成します。

+
+ +

構成要素のプロパティ

+ +

このプロパティは以下の CSS プロパティの一括指定です。

+ + + +

構文

+ +
/* 四辺すべてに適用 */
+padding: 1em;
+
+/* 上下 | 左右 */
+padding: 5% 10%;
+
+/* 上 | 左右 | 下 */
+padding: 1em 2em 2em;
+
+/* 上 | 右 | 下 | 左 */
+padding: 5px 1em 0 1em;
+
+/* グローバル値 */
+padding: inherit;
+padding: initial;
+padding: unset;
+
+ +

padding プロパティは1つ、2つ、3つ、4つの値を使って指定することができます。それぞれの値は {{cssxref("<length>")}} または {{cssxref("<percentage>")}} です。負の数は無効です。

+ + + +

+ +
+
{{cssxref("<length>")}}
+
固定値によるパディングの寸法です。
+
{{cssxref("<percentage>")}}
+
コンテナーブロックのに対するパーセント値によるパディングの寸法です。
+
+ +

公式定義

+ +

{{cssinfo}}

+ +

形式文法

+ +
{{csssyntax}}
+ +

+ +

パディングをピクセル数で設定

+ +

HTML

+ +
<h4>This element has moderate padding.</h4>
+<h3>The padding is huge in this element!</h3>
+
+ +

CSS

+ +
h4 {
+  background-color: lime;
+  padding: 20px 50px;
+}
+
+h3 {
+  background-color: cyan;
+  padding: 110px 50px 50px 110px;
+}
+
+ +

結果

+ +

{{EmbedLiveSample('Setting_padding_with_pixels', '100%', 300)}}

+ +

パディングをピクセル数とパーセント値で設定

+ +
padding: 5%;                /* 全辺: 5% のパディング */
+
+padding: 10px;              /* 全辺: 10px のパディング */
+
+padding: 10px 20px;         /* 上と下: 10px のパディング */
+                            /* 左と右: 20px のパディング */
+
+padding: 10px 3% 20px;      /* 上:     10px のパディング */
+                            /* 左と右: 3% のパディング   */
+                            /* 下:     20px のパディング */
+
+padding: 1em 3px 30px 5px;  /* 上:     1em のパディング  */
+                            /* 右:     3px のパディング  */
+                            /* 下:     30px のパディング */
+                            /* 右:     5px のパディング  */ 
+ +

仕様書

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
仕様書状態備考
{{SpecName('CSS3 Box', '#padding-shorthand', 'padding')}}{{Spec2('CSS3 Box')}}変更なし。
{{SpecName('CSS2.1', 'box.html#propdef-padding', 'padding')}}{{Spec2('CSS2.1')}}変更なし。
{{Specname('CSS1', '#padding', 'padding')}}{{Spec2('CSS1')}}初回定義
+ +

ブラウザーの互換性

+ + + +

{{Compat("css.properties.padding")}}

+ +

関連情報

+ + -- cgit v1.2.3-54-g00ecf