加入收藏 | 设为首页 | 会员中心 | 我要投稿 晋中站长网 (https://www.0354zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 运营中心 > 建站资源 > 优化 > 正文

45个值得收藏的CSS形状

发布时间:2019-04-23 13:11:29 所属栏目:优化 来源:前端小智
导读:CSS能够生成各种形状。正方形和矩形很容易,因为它们是 web 的自然形状。添加宽度和高度,就得到了所需的精确大小的矩形。添加边框半径,你就可以把这个形状变成圆形,足够多的边框半径,你就可以把这些矩形变成圆形和椭圆形。 我们还可以使用 CSS 伪元素

44.指示器

  1. #pointer {  
  2. width: 200px;  
  3. height: 40px;  
  4. position: relative;  
  5. background: red;  
  6. }  
  7. #pointer:after {  
  8. content: "";  
  9. position: absolute;  
  10. left: 0;  
  11. bottom: 0;  
  12. width: 0;  
  13. height: 0;  
  14. border-left: 20px solid white;  
  15. border-top: 20px solid transparent;  
  16. border-bottom: 20px solid transparent;  
  17. }  
  18. #pointer:before {  
  19. content: "";  
  20. position: absolute;  
  21. right: -20px;  
  22. bottom: 0;  
  23. width: 0;  
  24. height: 0;  
  25. border-left: 20px solid red;  
  26. border-top: 20px solid transparent;  
  27. border-bottom: 20px solid transparent;  
  28. }  

45.锁

  1. #lock {  
  2. font-size: 8px;  
  3. position: relative;  
  4. width: 18em;  
  5. height: 13em;  
  6. border-radius: 2em;  
  7. top: 10em;  
  8. box-sizing: border-box;  
  9. border: 3.5em solid red;  
  10. border-right-width: 7.5em;  
  11. border-left-width: 7.5em;  
  12. margin: 0 0 6rem 0;  
  13. }  
  14. #lock:before {  
  15. content: "";  
  16. box-sizing: border-box;  
  17. position: absolute;  
  18. border: 2.5em solid red;  
  19. width: 14em;  
  20. height: 12em;  
  21. left: 50%;  
  22. margin-left: -7em;  
  23. top: -12em;  
  24. border-top-left-radius: 7em;  
  25. border-top-right-radius: 7em;  
  26. }  
  27. #lock:after {  
  28. content: "";  
  29. box-sizing: border-box;  
  30. position: absolute;  
  31. border: 1em solid red;  
  32. width: 5em;  
  33. height: 8em;  
  34. border-radius: 2.5em;  
  35. left: 50%;  
  36. top: -1em;  
  37. margin-left: -2.5em;  

(编辑:晋中站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

热点阅读