边框图片

编程入门 行业动态 更新时间:2024-10-24 23:26:39

<a href=https://www.elefans.com/category/jswz/34/1766074.html style=边框图片"/>

边框图片

边框图片

css3中自适应边框图片运用:

组合写法:

border-image: url("images/border.jpg") 167/20px round;

拆分写法:

border-image-source: url("images/border.jpg");
border-image-slice: 167 167 167 167;
border-image-width: 20px;
border-image-repeat: round;

解释:

  • 边框图片资源地址
  • 裁剪尺寸(上 右 下 左)单位默认px,可使用百分百。
  • 边框图片的宽度,默认边框的宽度。
  • 平铺方式:
    • stretch 拉伸(默认)
    • repeat 平铺,从边框的中心向两侧开始平铺,会出现不完整的图片。
    • round 环绕,是完整的使用切割后的图片进行平铺。

DEMO代码:

<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><title>边框图片</title><style>ul{margin: 0;padding: 0;list-style: none;}li{width: 350px;height: 160px;border: 20px solid #ccc;margin-top: 20px;}li:nth-child(1){/*border-image: url("images/border.jpg") 167/20px round;*/border-image-source: url("images/border.jpg");border-image-slice: 167 167 167 167;border-image-width: 20px;/*环绕  是完整的使用切割后的图片进行平铺*/                    border-image-repeat: round; }li:nth-child(2){/*平铺 从边框的中心向两侧开始平铺 会出现不完整的图片*/                                         border-image: url("images/border.jpg") 167/20px repeat;}li:nth-child(3){/*默认的平铺方式*/border-image: url("images/border.jpg") 167/20px stretch;}</style>
</head>
<body>
<ul><li></li><li></li><li></li>
</ul>
</body>
</html>

更多推荐

边框图片

本文发布于:2023-07-28 18:41:35,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1277548.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:边框   图片

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!