--- title: inset slug: Web/CSS/inset tags: - CSS - CSS Logical Property - CSS Property - Experimental - Property - Reference - 'recipe:css-property' translation_of: Web/CSS/inset --- <div>{{CSSRef}}</div> <p><strong><code>inset</code></strong> は <a href="/ja/docs/Web/CSS">CSS</a> のプロパティで、 {{cssxref("top")}}, {{cssxref("right")}}, {{cssxref("bottom")}}, {{cssxref("left")}} に対応する一括指定です。これは {{cssxref("margin")}} の一括指定における複数値の場合と同じ構文です。</p> <p><em>CSS 論理的プロパティ</em>の仕様書で定義されているものですが、<em>論理的</em>なオフセットを定義するものではありません。これは<em>物理的</em>なオフセットであり、要素の書字方向やテキストの向きには関係がありません。</p> <pre class="brush:css no-line-numbers notranslate">/* <length> 値 */ inset: 10px; /* すべての辺に適用される値 */ inset: 4px 8px; /* 上/下 左/右 */ inset: 5px 15px 10px; /* 上 左/右 下 */ inset: 2.4em 3em 3em 3em; /* 上 右 下 左 */ /* 包含ブロックの幅 (左/右) または 高さ (上/下) に対する <percentage> */ inset: 10% 5% 5% 5%; /* キーワード値 */ inset: auto; /* グローバル値 */ inset: inherit; inset: initial; inset: unset; </pre> <h2 id="Syntax" name="Syntax">構文</h2> <h3 id="Values" name="Values">値</h3> <p><code>inset</code> プロパティは {{cssxref("left")}} プロパティと同じ値を取ります。</p> <h2 id="Formal_definition" name="Formal_definition">公式定義</h2> <p>{{cssinfo}}</p> <h2 id="Formal_syntax" name="Formal_syntax">形式文法</h2> {{csssyntax}} <h2 id="Examples" name="Examples">例</h2> <h3 id="Setting_offsets_for_an_element" name="Setting_offsets_for_an_element">要素のオフセットの設定</h3> <h4 id="HTML">HTML</h4> <pre class="brush: html notranslate"><div> <span class="exampleText">テキストの例</span> </div> </pre> <h4 id="CSS">CSS</h4> <pre class="brush: css notranslate">div { background-color: yellow; width: 150px; height: 120px; position: relative; } .exampleText { writing-mode: sideways-rl; position: absolute; inset: 20px 40px 30px 10px; background-color: #c8c800; }</pre> <h4 id="Result" name="Result">結果</h4> <p>{{EmbedLiveSample("Setting_offsets_for_an_element", 140, 140)}}</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("CSS Logical Properties", "#propdef-inset", "inset")}}</td> <td>{{Spec2("CSS Logical Properties")}}</td> <td>初回定義</td> </tr> </tbody> </table> <h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの互換性</h2> <p>{{Compat("css.properties.inset")}}</p> <h2 id="See_also" name="See_also">関連情報</h2> <ul> <li>個別指定のボックスのオフセットプロパティ: {{cssxref("top")}}, {{cssxref("right")}}, {{cssxref("bottom")}}, {{cssxref("left")}}</li> <li>対応する論理プロパティの一括指定: {{cssxref("inset-block")}} および {{cssxref("inset-inline")}}</li> <li>{{cssxref("margin")}} 一括指定の複数値の構文</li> </ul>