簡體   English   中英

邊框圖像重復不起作用

[英]border image repeat doesn't work

我想使用重復的三角形圖像制作頂部和底部邊框。 但是無法達到這個結果。 我只有一個三角形。 如何獲得如圖所示的重復三角形?

我的CSS:

border-style: solid;
border-width: 5px 5px 18px 20px;
border-image: url('../../img/triangle.png') 0 0 18 20 fill stretch;

您正在使用快捷方式“邊框圖像”屬性。 這里的stretch對應於border-image-repeat屬性。 將其設置為“重復”,而不是拉伸。

此外,您以錯誤的方式使用了屬性“ border-image-slice”。 這是一個很好的解釋在這里

您通常可以在此處找到有關border-image屬性的更多信息。

我建議您在第一次使用屬性時使用詳細版本:

 .banner{ width:600px; height: 200px; border-style: solid; border-width: 20px 0px 20px 0px; border-image-source: url('https://whatsarahread.com/wp-content/uploads/sites/113/2015/02/triangle-border.png'); border-image-slice: 100% 0%; border-image-repeat: repeat; } 
 <div class="banner"></div> 

使用“重復”代替Driblou定義的拉伸。

    border-image: url('../../img/triangle.png') 0 0 18 20 fill repeat;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM