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

45个值得收藏的CSS形状

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

26.钻石2

  1. #cut-diamond {  
  2. border-style: solid;  
  3. border-color: transparent transparent red transparent;  
  4. border-width: 0 25px 25px 25px;  
  5. height: 0;  
  6. width: 50px;  
  7. box-sizing: content-box;  
  8. position: relative;  
  9. margin: 20px 0 50px 0;  
  10. }  
  11. #cut-diamond:after {  
  12. content: "";  
  13. position: absolute;  
  14. top: 25px;  
  15. left: -25px;  
  16. width: 0;  
  17. height: 0;  
  18. border-style: solid;  
  19. border-color: red transparent transparent transparent;  
  20. border-width: 70px 50px 0 50px;  
  21. }  

27.蛋蛋

  1. #egg {  
  2. display: block;  
  3. width: 126px;  
  4. height: 180px;  
  5. background-color: red;  
  6. border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;  
  7. }  

28.吃豆人

  1. #pacman {  
  2. width: 0px;  
  3. height: 0px;  
  4. border-right: 60px solid transparent;  
  5. border-top: 60px solid red;  
  6. border-left: 60px solid red;  
  7. border-bottom: 60px solid red;  
  8. border-top-left-radius: 60px;  
  9. border-top-right-radius: 60px;  
  10. border-bottom-left-radius: 60px;  
  11. border-bottom-right-radius: 60px;  
  12. }  

29.对话泡泡

  1. #talkbubble {  
  2. width: 120px;  
  3. height: 80px;  
  4. background: red;  
  5. position: relative;  
  6. -moz-border-radius: 10px;  
  7. -webkit-border-radius: 10px;  
  8. border-radius: 10px;  
  9. }  
  10. #talkbubble:before {  
  11. content: "";  
  12. position: absolute;  
  13. right: 100%;  
  14. top: 26px;  
  15. width: 0;  
  16. height: 0;  
  17. border-top: 13px solid transparent;  
  18. border-right: 26px solid red;  
  19. border-bottom: 13px solid transparent;  
  20. }  

(编辑:晋中站长网)

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

热点阅读