23_图形.html 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>Document</title>
  7. <style>
  8. .box{
  9. width: 200px;
  10. height: 200px;
  11. background-color: red;
  12. }
  13. .circle{
  14. width: 200px;
  15. height: 200px;
  16. background-color: red;
  17. /* 圆形 在正方形基础上设置圆角 50% 就是圆 就是当前元素的一半 */
  18. border-radius: 50%;
  19. }
  20. .triangle{
  21. width: 0px;
  22. height: 0px;
  23. /* border:50px solid black; */
  24. border-top:50px solid rgba(0, 0, 0, 0);
  25. /* transparent 表示透明色 */
  26. border-left:50px solid transparent;
  27. border-bottom:50px solid transparent;
  28. border-right:50px solid yellow;
  29. }
  30. </style>
  31. </head>
  32. <body>
  33. <!-- 正方形 -->
  34. <!-- <div class="box"></div> -->
  35. <!-- 圆形 -->
  36. <!-- <div class="circle"></div> -->
  37. <!-- 三角形 -->
  38. <div class="triangle"></div>
  39. </body>
  40. </html>