css没有border,你未必知道的CSS小知识:为什么没有人使用border-image
之前我曾经写过一篇关于CSS的border-image属性的文章。现在几乎所有的现代浏览器都支持这个属性——除了IE10及以下IE版本。
看起来这是一个非常漂亮的CSS功能,它可以让你用图片修饰元素的边框。下面是一个实例演示,你可以拖拽调整里面的方块的大小,看看有什么边框图案的变化。
HTML代码
Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.
CSS代码
body {
font-family: Arial, sans-serif;
text-align: center;
}
.bi {
border: 45px solid transparent;
-webkit-border-image: url(http://www.webhek.com/wordpress/wp-content/uploads/2014/07/bg-pawprints-all.jpg) 45 round;
-moz-border-image: url(http://www.webhek.com/wordpress/wp-content/uploads/2014/07/bg-pawprints-all.jpg) 45 round;
border-image: url(http://www.webhek.com/wordpress/wp-content/uploads/2014/07/bg-pawprints-all.jpg) 45 round;
font-family: Arial, Helvetica, sans-serif;
color: #222;
width: 500px;
margin: 30px auto 30px auto;
overflow: hidden;
resize: both;
}
演示
但不幸的是,这么好的一个功能,却没有看到多少人使用它,也许是我的眼界太窄。如果你在哪看到过有人使用border-image属性,或你在真正项目中使用了它,请留言告诉我。
总结
以上是生活随笔为你收集整理的css没有border,你未必知道的CSS小知识:为什么没有人使用border-image的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: 548B. Mike and Fun
- 下一篇: CSS cursor鼠标样式一览表