当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


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。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。