From 376c645e2bb44c10317c3f3b8aca53f16da0975a Mon Sep 17 00:00:00 2001 From: Masahiro FUJIMOTO Date: Mon, 8 Nov 2021 10:35:25 +0900 Subject: CSS Box Model のプロパティを更新 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 2021/11/07 時点の英語版に同期 --- files/ja/web/css/margin-top/index.md | 111 +++++++++++++---------------------- 1 file changed, 42 insertions(+), 69 deletions(-) (limited to 'files/ja/web/css/margin-top') diff --git a/files/ja/web/css/margin-top/index.md b/files/ja/web/css/margin-top/index.md index fa48d0b5eb..334fd8d539 100644 --- a/files/ja/web/css/margin-top/index.md +++ b/files/ja/web/css/margin-top/index.md @@ -3,24 +3,24 @@ title: margin-top slug: Web/CSS/margin-top tags: - CSS - - CSS Property - - Reference - - 'recipe:css-property' + - CSS プロパティ + - リファレンス + - recipe:css-property +browser-compat: css.properties.margin-top translation_of: Web/CSS/margin-top --- -
{{CSSRef}}
+{{CSSRef}} -

margin-topCSS のプロパティで、要素の上側のマージン領域を設定します。正の数を指定すると、隣との間が遠くなるように配置され、負の数を指定すると、近くなるように配置します。

+**`margin-top`** は [CSS](/ja/docs/Web/CSS) のプロパティで、要素の上側の[マージン領域](/ja/docs/Web/CSS/CSS_Box_Model/Introduction_to_the_CSS_box_model#マージン領域)を設定します。正の数を指定すると、隣との間が遠くなるように配置され、負の数を指定すると、近くなるように配置します。 -
{{EmbedInteractiveExample("pages/css/margin-top.html")}}
+{{EmbedInteractiveExample("pages/css/margin-top.html")}} - +このプロパティは、[置換要素](/ja/docs/Web/CSS/Replaced_element)ではないインライン要素、例えば {{HTMLElement("span")}} や {{HTMLElement("code")}} には効果がありません。 -

このプロパティは、置換要ではないインライン要素、例えば {{HTMLElement("span")}} や {{HTMLElement("code")}} には効果がありません。

+## 構文 -

構文

- -
/* <length> 値 */
+```css
+/*  値 */
 margin-top: 10px;  /* 絶対的な寸法 */
 margin-top: 1em;   /* 文字の寸法からの相対 */
 margin-top: 5%;    /* 直近のブロックコンテナーの幅からの相対 */
@@ -31,76 +31,49 @@ margin-top: auto;
 /* グローバル値 */
 margin-top: inherit;
 margin-top: initial;
+margin-top: revert;
 margin-top: unset;
-
+``` -

margin-top プロパティは auto キーワード、または <length><percentage> で指定されます。正の数、ゼロ、負の数が指定できます。

+`margin-top` プロパティは `auto` キーワード、または `` や `` で指定されます。正の数、ゼロ、負の数が指定できます。 -

+### 値 -
-
{{cssxref("<length>")}}
-
固定値によるマージンの寸法です。
-
{{cssxref("<percentage>")}}
-
包含ブロックの width に対するパーセントによるマージンの寸法です。
-
auto
-
ブラウザ―が適切な値を選択して使用します。 {{cssxref("margin")}} を参照してください。
-
+- {{cssxref("<length>")}} + - : マージンの寸法を固定値で表したものです。 +- {{cssxref("<percentage>")}} + - : マージンの寸法を包含ブロックの*幅*に対するパーセント値で表したものです。 +- `auto` + - : ブラウザーが適切な値を選択して使用します。 {{cssxref("margin")}} を参照してください。 -

公式定義

+## 公式定義 -

{{cssinfo}}

+{{cssinfo}} -

形式文法

+## 形式文法 {{csssyntax}} -

+## 例 -

正と負の上マージンの設定

+### 正と負の上マージンの設定 -
.content { margin-top:   5%; }
+```css
+.content { margin-top:   5%; }
 .sidebox { margin-top: 10px; }
 .logo    { margin-top: -5px; }
 #footer  { margin-top:  1em; }
-
- -

仕様書

- - - - - - - - - - - - - - - - - - - - - - - - - - -
仕様書状態備考
{{SpecName('CSS3 Box', '#the-margin', 'margin-top')}}{{Spec2('CSS3 Box')}}目立った変更なし。
{{SpecName('CSS2.1', 'box.html#margin-properties', 'margin-top')}}{{Spec2('CSS2.1')}}ただしインライン要素での効果を削除。
{{SpecName('CSS1', '#margin-top', 'margin-top')}}{{Spec2('CSS1')}}初回定義
- -

ブラウザーの互換性

- -

{{Compat("css.properties.margin-top")}}

- -

関連情報

- -
    -
  • {{cssxref("margin-right")}}, {{cssxref("margin-bottom")}}, {{cssxref("margin-left")}} と {{cssxref("margin")}} 一括指定
  • -
  • 対応付けられる論理的プロパティ: {{cssxref("margin-block-start")}}, {{cssxref("margin-block-end")}}, {{cssxref("margin-inline-start")}}, {{cssxref("margin-inline-end")}} および一括指定の {{cssxref("margin-block")}} と {{cssxref("margin-inline")}}
  • -
+``` + +## 仕様書 + +{{Specifications}} + +## ブラウザーの互換性 + +{{Compat}} + +## 関連情報 + +- {{cssxref("margin-right")}}, {{cssxref("margin-bottom")}}, {{cssxref("margin-left")}} と {{cssxref("margin")}} 一括指定 +- 対応付けられる論理的プロパティ: {{cssxref("margin-block-start")}}, {{cssxref("margin-block-end")}}, {{cssxref("margin-inline-start")}}, {{cssxref("margin-inline-end")}} および一括指定の {{cssxref("margin-block")}} と {{cssxref("margin-inline")}} -- cgit v1.2.3-54-g00ecf