欢迎光临
我们一直在努力

css中的border-image属性怎么用

这篇文章主要为大家展示了“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属性怎么用”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注云搜网行业资讯频道!

赞(0)
【声明】:本博客不参与任何交易,也非中介,仅记录个人感兴趣的主机测评结果和优惠活动,内容均不作直接、间接、法定、约定的保证。访问本博客请务必遵守有关互联网的相关法律、规定与规则。一旦您访问本博客,即表示您已经知晓并接受了此声明通告。