--- title: border-image-repeat slug: Web/CSS/border-image-repeat tags: - CSS - CSS プロパティ - CSS 背景と境界 - border-image - リファレンス translation_of: Web/CSS/border-image-repeat ---
CSS の border-image-repeat プロパティは、元画像の辺の領域を、どうやって要素の境界画像に合うように合わせるかを定義します。
/* キーワード値 */ 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;
border-image-repeat プロパティは、下記の値のリストにある1つ又は2つの値を使用して指定することができます。
stretchrepeatroundspace#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 で変更可能 */
}
<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>
var repetition = document.getElementById("repetition");
repetition.addEventListener("change", function (evt) {
document.getElementById("bordered").style.borderImageRepeat = evt.target.value;
});
{{EmbedLiveSample("Example", "auto", 200)}}
| 仕様書 | 策定状況 | コメント |
|---|---|---|
| {{SpecName('CSS3 Backgrounds', '#the-border-image-repeat', 'border-image-repeat')}} | {{Spec2('CSS3 Backgrounds')}} | 初回定義 |
{{Compat("css.properties.border-image-repeat")}}