css中的border-image属性怎么用

发布时间:2022-02-25 13:45:27 作者:小新
来源:亿速云 阅读:219

这篇文章主要为大家展示了“css中的border-image属性怎么用”,内容简而易懂,条理清晰,希望能够帮助大家解决疑惑,下面让小编带领大家一起研究并学习一下“css中的border-image属性怎么用”这篇文章吧。

  CSS3border-image属性

  作用:使用图片来创建边框

  说明:复合属性。设置或检索对象的边框样式使用图像来填充。可以一次性设置:border-image-source,border-image-slice,border-image-width,border-image-outset和border-image-repeat属性的值。

  语法:

  border-image:sourceslicewidthoutsetrepeat|initial|inherit;

  参数:

  border-image-source:用于指定要用于绘制边框的图像的位置。

  border-image-slice:图像边界向内偏移。

  border-image-width:图像边界的宽度。

  border-image-outset:用于指定在边框外部绘制border-image-area的量。

  border-image-repeat:用于设置图像边界是否应重复(repeat)、拉伸(stretch)或铺满(round)。

  css3border-image属性使用示例

  <!DOCTYPEhtml>

  <html>

  <head>

  <style>

  div

  {

  border:15pxsolidtransparent;

  width:300px;

  padding:10px20px;

  }

  #round

  {

  -moz-border-image:url(https://img.php.cn/upload/article/000/005/656/5af270fd37755429.jpg)3030round;/*OldFirefox*/

  -webkit-border-image:url(https://img.php.cn/upload/article/000/005/656/5af270fd37755429.jpg)3030round;/*SafariandChrome*/

  -o-border-image:url(https://img.php.cn/upload/article/000/005/656/5af270fd37755429.jpg)3030round;/*Opera*/

  border-image:url(https://img.php.cn/upload/article/000/005/656/5af270fd37755429.jpg)3030round;

  }

  #stretch

  {

  -moz-border-image:url(https://img.php.cn/upload/article/000/005/656/5af270fd37755429.jpg)3030stretch;/*OldFirefox*/

  -webkit-border-image:url(https://img.php.cn/upload/article/000/005/656/5af270fd37755429.jpg)3030stretch;/*SafariandChrome*/

  -o-border-image:url(https://img.php.cn/upload/article/000/005/656/5af270fd37755429.jpg)3030stretch;/*Opera*/

  border-image:url(https://img.php.cn/upload/article/000/005/656/5af270fd37755429.jpg)3030stretch;

  }

  </style>

  </head>

  <body>

  <divid="round">在这里,图片铺满整个边框。</div>

  <br>

  <divid="stretch">在这里,图片被拉伸以填充该区域。</div>

  <p>这是我们使用的图片:</p>

  <imgsrc="https://img.php.cn/upload/article/000/000/024/5c513adf97e86533.jpg">

  <p><b>注释:</b>InternetExplorer不支持border-image属性。</p>

  <p>border-image属性规定了用作边框的图片。</p>

  </body>

  </html>


css中的border-image属性怎么用


以上是“css中的border-image属性怎么用”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注亿速云行业资讯频道!

推荐阅读:
  1. css中如何使用border-image属性
  2. css border-image属性用法

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

css

上一篇:css中的outline-offset属性怎么用

下一篇:css中的animation-name属性怎么用

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》