當前位置: 首頁>>代碼示例 >>用法及示例精選 >>正文


CSS border-image-outset用法及代碼示例


CSS border-image-outset屬性是一種簡寫屬性,用於指定元素邊框圖像放置在其框外的距離。

注意:border-image-outset對border-image-source指定的圖片生效。

用法:


border-image-outset:value;

屬性值:

影響
Length 將邊框起始尺寸指定為尺寸。
Number 將邊框的大小指定為對應的border-width的倍數。
Initial 將邊框的大小指定為默認大小。
Inherit 從其父元素繼承值。

示例程序:

<!DOCTYPE html>  
<html>  
    <head>  
        <style>  
            body {  
                text-align:center;  
            }  
            h1 {  
                color:green;  
            }  
              
            .border1 {  
                border:10px solid transparent;  
                padding:15px;  
                border-image-source:url(  
https://media.geeksforgeeks.org/wp-content/uploads/border1-2.png);  
                   border-image-repeat:round;  
                border-image-width:20px; 
                border-image-slice:30; 
                border-image-outset:10px 20px 12px 9px;  
            }  
            .border2 {  
                border:10px solid transparent;  
                padding:15px;  
                border-image-source:url(  
https://media.geeksforgeeks.org/wp-content/uploads/border1-2.png);  
                border-image-repeat:round;  
                border-image-outset:1; 
                border-image-slice:30; 
                border-image-width:20px;  
            }  
            .border3 {  
                border:10px solid transparent;  
                padding:15px;  
                border-image-source:url(  
https://media.geeksforgeeks.org/wp-content/uploads/border1-2.png);  
                border-image-repeat:round;  
                border-image-outset:initial;  
                border-image-width:20px;  
            }  
            .border4 {  
                border:10px solid transparent;  
                padding:15px;  
                border-image-source:url(  
https://media.geeksforgeeks.org/wp-content/uploads/border1-2.png);  
                border-image-repeat:round;  
                border-image-outset:inherit;  
                border-image-width:20px;  
            }  
          
            div {  
                margin-top:20px;  
            }  
        </style>  
    </head>  
    <body>  
        <h1>GeeksforGeeks</h1>  
        <h2>border-image-outset property</h2>  
        <div class = "border1">Border 1(Length)</div>  
        <div class = "border2">Border 2(Number)</div>  
        <div class = "border3">Border 3(Initial)</div>  
        <div class = "border4">Border 4(Inherit)</div>  
    </body>  
</html>    

輸出:

瀏覽器支持:下麵列出了border-image-outset屬性支持的瀏覽器:

  • chrome 15.0
  • Edge-11.0
  • Firefox-15.0
  • Opera 15.0
  • Safari 6.0


相關用法


注:本文由純淨天空篩選整理自DannanaManoj大神的英文原創作品 CSS | border-image-outset Property。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。