css boder-image 属性使用
border-style: solid;border-color: transparent;border-width: 50px 19px 19px 19px;border-image: url("./images/i15.png");border-image-slice: 100 38 38 38;border-image-repeat: repeat stretch;
border-width: 50px 19px 19px 19px;
需要要先设置 border-width
上边距50,其他19
border-image-repeat: repeat stretch;
- 第一个值
repeat控制上、下边框的重复方式(上边框不拉伸) - 第二个值
stretch控制左、右边框的重复方式(拉伸)
border-image-slice: 100 38 38 38;
边框切片比例匹配
border-image-slice: 40 15 15 15与border-width: 40px 15px 15px 15px保持相同比例
这里用了两倍的比例
如果项目样式存在不规则边框,可以使用border-imge 这个属性
浏览器可能存在兼容性
-webkit-border-image: ...;
-moz-border-image: ...;
-o-border-image: ...;
border-image: ...;