译者:cl9000
原文:https://css-tricks.com/the-shapes-of-css/
CSS能够制作各种形状。方形和长方形很简单,因为它们是网的自然形状。添加宽度和高度,你就有了你需要的确切大小的矩形。添加边界半径,你可以圆形的形状,和足够的它,你可以把这些矩形变成圆形和椭圆形。
我们还在CSS中获得了::before和::after伪元素,这使我们可以向原始元素添加两个形状。通过巧妙地使用定位、转换和许多其他技巧,我们可以只用一个HTML元素在CSS中创建许多形状。
These days, you’re best bet for drawing shapes is either SVG or using a clip-path in CSS, which is SVG-like (and can reference SVG). For example, look at these SVG icon sets, or this clip-path editor. This article was written originally before either of these technologies really took hold!
【译文】虽然我们现在大都使用字体图标或者svg图片,似乎使用 CSS 来做图标意义不是很大,但怎么实现这些图标用到的一些技巧及思路是很值得我们的学习。
矩形(Rectangle Shape)
1 | #rectangle { |
圆形(Circle Shape)
1 | #circle { |
椭圆形(Oval Shape)
1 | #oval { |
上三角形(Triangle Up Shape)
1 | #triangle-up { |
下三角形 (Triangle Down Shape)
1 | #triangle-up { |
左三角形 (Triangle Left Shape)
1 | #triangle-left { |
右三角形 (Triangle Right Shape)
1 | #triangle-right { |
左上角三角形 (Triangle Top Left Shape)
1 | #triangle-topleft { |
右上角三角形 (Triangle Top Right Shape)
1 | #triangle-topright { |
左下角三角形 (Triangle Bottom Left Shape)
1 | #triangle-bottomleft { |
右下角三角形 (Triangle Bottom Right Shape)
1 | #triangle-bottomright { |
弯尾箭形 (Curved Tail Arrow Shape)
1 | #curvedarrow { |
梯形 (Trapezoid Shape)
1 | #trapezoid { |
平行四边 (Parallelogram Shape)
1 | #parallelogram { |
星(6分)的形状 (Star (6-points) Shape)
1 | #parallelogram { |
星(5分)的形状 (Star (5-points) Shape)
1 | #star-five { |
五角大楼的形状 (Pentagon Shape)
1 | #parallelogram { |
六边形的形状 (Hexagon Shape)
1 | #parallelogram { |
八角形状 (Octagon Shape)
1 | #octagon { |
心形 (Heart Shape)
1 | #heart { |
∞形状 (Infinity Shape )
1 | #infinity { |
钻石广场形状 (Diamond Square Shape)
1 | #diamond { |
钻石盾牌形状 (Diamond Shield Shape)
1 | #diamond-shield { |
钻石狭窄的形状 (Diamond Narrow Shape)
1 | #diamond-narrow { |
切割钻石形状 (Cut Diamond Shape)
1 | #cut-diamond { |
鸡蛋的形状 (Egg Shape)
1 | #egg { |
吃豆人的形状 (Pac-Man Shape)
1 | #pacman { |
谈论泡沫形状 (Talk Bubble Shape)
1 | #talkbubble { |
RSS提要的形状 (RSS Feed Shape)
1 | #rss { |
12点爆破形状 (12 Point Burst Shape)
1 | #burst-12 { |
8点爆破形状 (8 Point Burst Shape)
1 | #burst-8 { |
阴阳形状/太极 (Yin Yang Shape)
1 | #yin-yang { |
徽章丝带形状 (Badge Ribbon Shape)
1 | #badge-ribbon { |
太空入侵者的形状 (Space Invader Shape)
1 | #space-invader { |
电视屏幕的形状 (TV Screen Shape)
1 | #tv { |
雪佛龙的形状 (Chevron Shape)
1 | #chevron { |
放大镜的形状 (Magnifying Glass Shape)
1 | #magnifying-glass { |
脸书图标 (Facebook Icon Shape)
1 | #facebook-icon { |
月亮形状 (Moon Shape)
1 | #moon { |
标签形状 (Flag Shape)
1 | #flag { |
锥形状 (Cone Shape )
1 | #cone { |
十字形状 (Cross Shape)
1 | #cross { |
基地形状 (Base Shape)
1 | #base { |
指针的形状 (Pointer Shape)
1 | #pointer { |
锁的形状 (Lock Shape)
1 | #moon { |
扭转角的形状 (Reverse Corners Shape)
1 | #curved-corner-bottomleft, |
赞赏一下 坚持原创技术分享,您的支持将鼓励我继续创作!