4.常用样式.html 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. /*
  9. 选择器:
  10. 1.标签选择器:
  11. div {}
  12. 标签名 {样式}
  13. 样式:
  14. 宽度:width
  15. 高度:height
  16. 颜色:color
  17. 像素单位:px
  18. 单位:px %
  19. 边框:border:width style color
  20. width
  21. style:solid 实线 dashed 虚线 double 双边框 dotted 点线
  22. color
  23. 复合属性
  24. 上边框:border-top
  25. 下边框 border-bottom
  26. 左边框 border-left
  27. 右边框 border-right
  28. border-radius 圆角边框
  29. 50% 原型
  30. 单独一个方向
  31. border-上下-左右-radius
  32. 同选择器 同样式 后面的会覆盖前面的
  33. background:背景 复合属性
  34. background-color:背景色
  35. background-image:url("图片路径")
  36. background:color image repeat position;
  37. background-repeat: 背景平铺
  38. no-repeat 不平铺
  39. repeat-x x轴平铺
  40. repeat-y y轴平铺
  41. repeat 平铺
  42. background-position:x y;
  43. 背景位置
  44. background-size 背景尺寸:
  45. contain 等比例放置最大
  46. cover 完全覆盖
  47. */
  48. div {
  49. width: 900px;
  50. height: 900px;
  51. color: purple;
  52. /* border-width: 10px;
  53. border-style: double;
  54. border-color: #0f0; */
  55. border:2px solid #f00;
  56. /* border-left: 10px solid rgb(123, 0, 255); */
  57. /* border-top: 1px solid #f00; */
  58. /* border-radius: 20px; */
  59. border-top-left-radius: 20px;
  60. /* background: #ff0;
  61. background-image: url("./img01.gif");
  62. background-color: yellowgreen;
  63. background-repeat: no-repeat; */
  64. /* background-position: center 20px; */
  65. /* background-size: cover; */
  66. background: #f00 url('./img01.gif') no-repeat center center;
  67. }
  68. </style>
  69. </head>
  70. <body>
  71. <!--
  72. 常用样式:
  73. -->
  74. <div>
  75. 你好,我有一个帽衫
  76. </div>
  77. </body>
  78. </html>