--- title: border-image-repeat slug: Web/CSS/border-image-repeat tags: - CSS - CSS Borders - CSS Property - Reference translation_of: Web/CSS/border-image-repeat --- <div>{{CSSRef}}</div> <h2 id="Summary">Summary</h2> <p><code>border-image-repeat </code>定义图片如何填充边框。或为单个值,设置所有的边框;或为两个值,分别设置水平与垂直的边框。</p> <div>{{cssinfo}}</div> <h2 id="Syntax">Syntax</h2> <pre class="twopartsyntaxbox"><a href="/en-US/docs/CSS/Value_definition_syntax" title="CSS/Value_definition_syntax">Formal syntax</a>: {{csssyntax("border-image-repeat")}} </pre> <pre>border-image-repeat: <em>type</em> <em> /* One-value syntax */</em> E.g. border-image-value: stretch; border-image-repeat: <em>horizontal</em> <em>vertical</em> <em>/* Two-value syntax */ </em>E.g. border-image-width: round space; border-image-repeat: inherit </pre> <h3 id="Values">Values</h3> <dl> <dt><em>type</em></dt> <dd><code>stretch</code>, <code>repeat</code>, <code>round</code>, <code>space</code> 选一。属于单个值的情况。</dd> <dt><em>horizontal</em></dt> <dd><code>stretch</code>, <code>repeat</code>, <code>round</code>, <code>space</code> 选一。属于两个值的情况。</dd> <dt><em>vertical</em></dt> <dd><code>stretch</code>, <code>repeat</code>, <code>round</code>, <code>space</code> 选一。属于两个值的情况。</dd> <dt><code>stretch</code></dt> <dd>拉伸图片以填充边框。</dd> <dt><code>repeat</code></dt> <dd>平铺图片以填充边框。</dd> <dt><code>round</code></dt> <dd>平铺图像。当不能整数次平铺时,根据情况放大或缩小图像。</dd> <dt><code>space</code></dt> <dd>平铺图像 。当不能整数次平铺时,会用空白间隙填充在图像周围(不会放大或缩小图像)</dd> <dt><code>inherit</code></dt> <dd>继承父级元素的计算值。</dd> </dl> <h2 id="Specifications" name="Specifications">Examples</h2> <p>不同的取值,查看 {{cssxref("border-image")}} 的示例。</p> <h2 id="Specifications" name="Specifications">Specifications</h2> <table class="standard-table"> <thead> <tr> <th scope="col">Specification</th> <th scope="col">Status</th> <th scope="col">Comment</th> </tr> </thead> <tbody> <tr> <td>{{SpecName('CSS3 Backgrounds', '#border-image-repeat', 'border-image-repeat')}}</td> <td>{{Spec2('CSS3 Backgrounds')}}</td> <td>Initial specification</td> </tr> </tbody> </table> <h2 id="Browser_compatibility">Browser compatibility</h2> <div>{{CompatibilityTable}}</div> <div id="compat-desktop"> <table class="compat-table"> <tbody> <tr> <th>Feature</th> <th>Chrome</th> <th>Firefox (Gecko)</th> <th>Internet Explorer</th> <th>Opera</th> <th>Safari</th> </tr> <tr> <td>Basic support</td> <td>15.0</td> <td>{{CompatGeckoDesktop("15.0")}}</td> <td>{{CompatNo}}</td> <td>{{CompatNo}}</td> <td>{{CompatNo}}</td> </tr> </tbody> </table> </div> <div id="compat-mobile"> <table class="compat-table"> <tbody> <tr> <th>Feature</th> <th>Android</th> <th>Firefox Mobile (Gecko)</th> <th>IE Phone</th> <th>Opera Mobile</th> <th>Safari Mobile</th> </tr> <tr> <td>Basic support</td> <td>{{CompatUnknown}}</td> <td>{{CompatGeckoMobile("15.0")}}</td> <td>{{CompatNo}}</td> <td>{{CompatUnknown}}</td> <td>{{CompatUnknown}}</td> </tr> </tbody> </table> </div> <p><code>早期候选推荐版本中有space,不过没有浏览器实现它,因而移除,将来可能添加进来。</code></p>