--- title: offset slug: Web/CSS/offset tags: - CSS - CSS Motion Path - CSS Property - Experimental - Reference - 'recipe:css-shorthand-property' translation_of: Web/CSS/offset --- <p>{{CSSRef}}</p> <p><strong><code>offset</code></strong> は CSS の<a href="/ja/docs/Web/CSS/Shorthand_properties">一括指定プロパティ</a>で、要素を定義された経路に沿って動かすのに必要なすべてのプロパティを設定します。</p> <div class="note"> <p><strong>注</strong>: 仕様書の早期の版では、このプロパティを <code>motion</code> と呼んでいました。</p> </div> <h2 id="Constituent_properties" name="Constituent_properties">構成要素のプロパティ</h2> <p>このプロパティは以下の CSS プロパティの一括指定です。</p> <ul> <li>{{cssxref("offset-anchor")}}</li> <li>{{cssxref("offset-distance")}}</li> <li>{{cssxref("offset-path")}}</li> <li>{{cssxref("offset-position")}}</li> <li>{{cssxref("offset-rotate")}}</li> </ul> <h2 id="Syntax" name="Syntax">構文</h2> <pre class="brush: css notranslate">/* オフセット位置 */ offset: auto; offset: 10px 30px; offset: none; /* オフセット経路 */ offset: ray(45deg closest-side); offset: path('M 100 100 L 300 100 L 200 300 z'); offset: url(arc.svg); /* オフセット経路に距離と回転が加わったもの */ offset: url(circle.svg) 100px; offset: url(circle.svg) 40%; offset: url(circle.svg) 30deg; offset: url(circle.svg) 50px 20deg; /* オフセットアンカーを含む */ offset: ray(45deg closest-side) / 40px 20px; offset: url(arc.svg) 2cm / 0.5cm 3cm; offset: url(arc.svg) 30deg / 50px 100px; </pre> <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="Animating_an_element_along_a_path" name="Animating_an_element_along_a_path">経路に沿って要素を動かす</h3> <h4 id="HTML">HTML</h4> <pre class="brush: html notranslate"><div id="offsetElement"></div> </pre> <h4 id="CSS">CSS</h4> <pre class="brush: css notranslate">@keyframes move { from { offset-distance: 0%; } to { offset-distance: 100%; } } #offsetElement { width: 50px; height: 50px; background-color: blue; offset: path("M 100 100 L 300 100 L 200 300 z") auto; animation: move 3s linear infinite; } </pre> <h4 id="Result" name="Result">結果</h4> <p>{{EmbedLiveSample("Animating_an_element_along_a_path", 350, 350)}}</p> <h2 id="Specifications" name="Specifications">仕様書</h2> <table class="standard-table"> <thead> <tr> <th>仕様書</th> <th>状態</th> <th>備考</th> </tr> </thead> <tbody> <tr> <td>{{SpecName('Motion Path Level 1', '#offset-shorthand', 'offset')}}</td> <td>{{Spec2('Motion Path Level 1')}}</td> <td>初回定義</td> </tr> </tbody> </table> <h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの互換性</h2> <p>{{Compat("css.properties.offset")}}</p>