CSS的outline和border区别和css形状


The CSS outline property is a confusing property. When you first learn about it, it's hard to understand how it is even remotely different from the border property. The W3C explains it as having the following differences:

1.Outlines do not take up space. 不占空间

2.Outlines may be non-rectangular. 可以不是矩形

From: http://webdesign.about.com/od/advancedcss/a/outline_style.htm

看看下面的例子,加上outline会不一样

https://css-tricks.com/the-shapes-of-css/, 这里面有很多css描绘的形状,css描述的形状都基本上会写死尺寸,也许使用svg更灵活:https://slides.com/sarasoueidan/building-better-interfaces-with-svg#/9

#circle {
 width: 100px;
 height: 100px;
 background: red;
 border-radius: 50%;
 outline: solid blue;
 }
阅读量: 594
发布于:
修改于: