--- title: border-image-repeat slug: Web/CSS/border-image-repeat tags: - CSS - CSS プロパティ - CSS 背景と境界 - border-image - リファレンス translation_of: Web/CSS/border-image-repeat --- <div>{{CSSRef}}</div> <p><a href="/ja/docs/Web/CSS">CSS</a> の <strong><code>border-image-repeat</code></strong> プロパティは、元画像の<a href="/ja/docs/Web/CSS/border-image-slice#edge-regions">辺の領域</a>を、どうやって要素の<a href="/ja/docs/Web/CSS/border-image">境界画像</a>に合うように合わせるかを定義します。</p> <div>{{EmbedInteractiveExample("pages/css/border-image-repeat.html")}}</div> <h2 id="Syntax" name="Syntax">構文</h2> <pre class="brush:css no-line-numbers">/* キーワード値 */ border-image-repeat: stretch; border-image-repeat: repeat; border-image-repeat: round; border-image-repeat: space; /* 垂直 | 水平 */ border-image-repeat: round stretch; /* グローバル値 */ border-image-repeat: inherit; border-image-repeat: initial; border-image-repeat: unset; </pre> <p><code>border-image-repeat</code> プロパティは、下記の値のリストにある1つ又は2つの値を使用して指定することができます。</p> <ul> <li>値が<strong>1つ</strong>指定された場合、<strong>全4辺</strong>に同じ動作が適用されます。</li> <li>値が<strong>2つ</strong>指定された場合、1つ目の動作が<strong>上下</strong>に、2つ目が<strong>左右</strong>に適用されます。</li> </ul> <h3 id="Values" name="Values">値</h3> <dl> <dt><code>stretch</code></dt> <dd>2つの境界の間を埋めるために、元画像の辺の領域が引き伸ばされます。</dd> <dt><code>repeat</code></dt> <dd>2つの境界の間を埋めるために、元画像の辺の領域を (繰り返して) 並べます。寸法を合わせるために領域の一部が切り取られることがあります。</dd> <dt><code>round</code></dt> <dd>2つの境界の間を埋めるために、元画像の辺の領域を (繰り返して) 並べます。寸法を合わせるために領域が引き延ばされることがあります。</dd> <dt><code>space</code></dt> <dd>2つの境界の間を埋めるために、元画像の辺の領域を (繰り返して) 並べます。寸法を合わせるために領域間に間隔が置かれることがあります。</dd> </dl> <h3 id="Formal_syntax" name="Formal_syntax">形式文法</h3> {{csssyntax}} <h2 id="Example" name="Example">例</h2> <h3 id="CSS_content" name="CSS_content">CSS コンテンツ</h3> <pre class="brush: css; highlight[7]">#bordered { width: 12rem; margin-bottom: 1rem; padding: 1rem; border: 40px solid; border-image: url("https://mdn.mozillademos.org/files/4127/border.png") 27; border-image-repeat: stretch; /* live sample で変更可能 */ } </pre> <div class="hidden"> <h3 id="HTML">HTML</h3> <pre class="brush: html"><div id="bordered">You can try out various border repetition rules on me!</div> <select id="repetition"> <option value="stretch">stretch</option> <option value="repeat">repeat</option> <option value="round">round</option> <option value="space">space</option> <option value="stretch repeat">stretch repeat</option> <option value="space round">space round</option> </select> </pre> <h3 id="JavaScript">JavaScript</h3> <pre class="brush: js">var repetition = document.getElementById("repetition"); repetition.addEventListener("change", function (evt) { document.getElementById("bordered").style.borderImageRepeat = evt.target.value; }); </pre> </div> <p>{{EmbedLiveSample("Example", "auto", 200)}}</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('CSS3 Backgrounds', '#the-border-image-repeat', 'border-image-repeat')}}</td> <td>{{Spec2('CSS3 Backgrounds')}}</td> <td>初回定義</td> </tr> </tbody> </table> <div>{{cssinfo}}</div> <h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの対応</h2> <p>{{Compat("css.properties.border-image-repeat")}}</p>