aboutsummaryrefslogtreecommitdiff
path: root/files/ja/web/css/initial/index.md
blob: b474d464b18d65d45a0f2ec51532782aade1041e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
---
title: initial
slug: Web/CSS/initial
tags:
  - CSS
  - CSS カスケードと継承
  - CSS 値
  - Reference
  - initial
  - レイアウト
  - 初期値
translation_of: Web/CSS/initial
---
<div>{{CSSRef}}</div>

<p><span class="seoSummary"><strong><code>initial</code></strong> は CSS のキーワードで、要素にプロパティの<a href="/ja/docs/Web/CSS/initial_value">初期値 (または既定値)</a> を設定します。どの CSS プロパティにも適用できます。</span>これは CSS の一括指定 {{cssxref("all")}} を含み、 <code>initial</code> を指定して、すべての CSS プロパティを初期値に戻すために使用することができます。</p>

<div class="note">
<p><strong>注:</strong> <a href="/ja/docs/Web/CSS/inheritance#Inherited_properties">継承プロパティ</a>では、初期値は期待されない値かもしれません。代わりに {{cssxref("inherit")}}, {{cssxref("unset")}}, {{cssxref("revert")}} キーワードを使用することを検討してください。</p>
</div>

<h2 id="Example" name="Example">例</h2>

<h4 id="HTML">HTML</h4>

<pre class="brush: html notranslate">&lt;p&gt;
  &lt;span&gt;このテキストは赤です。&lt;/span&gt;
  &lt;em&gt;このテキストは初期値 (ふつうは黒) です。&lt;/em&gt;
  &lt;span&gt;これは再び赤です。&lt;/span&gt;
&lt;/p&gt;</pre>

<h4 id="CSS">CSS</h4>

<pre class="brush: css notranslate">p {
  color: red;
}

em {
  color: initial;
}</pre>

<p>{{EmbedLiveSample('Example')}}</p>

<h2 id="Specifications" name="Specifications">仕様書</h2>

<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">仕様書</th>
   <th scope="col">状態</th>
   <th scope="col">備考</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{ SpecName('CSS4 Cascade', '#initial', 'initial') }}</td>
   <td>{{Spec2('CSS4 Cascade')}}</td>
   <td>Level 3 から変更なし。</td>
  </tr>
  <tr>
   <td>{{ SpecName('CSS3 Cascade', '#initial', 'initial') }}</td>
   <td>{{Spec2('CSS3 Cascade')}}</td>
   <td>初回定義</td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの互換性</h2>

<p>{{Compat("css.types.global_keywords.initial")}}</p>

<h2 id="See_also" name="See_also">関連情報</h2>

<ul>
 <li>{{cssxref("unset")}} を使用すると、継承プロパティは継承値に、それ以外は初期値に設定します。</li>
 <li>{{cssxref("revert")}} を使用すると、プロパティをユーザーエージェントのスタイルシート (又はもしあれば、ユーザーのスタイル) で設定された値に初期化します。</li>
 <li>{{cssxref("inherit")}} を使用すると、要素のプロパティを親と同じ値にします。</li>
 <li>{{cssxref("all")}} プロパティは、すべてのプロパティを一度に initial, inherit, revert, unset の状態にします。</li>
</ul>