2.css中常用样式.html 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. div {
  10. /* 属性:属性值; */
  11. /* 宽度:width
  12. 高度: height
  13. 像素单位:px
  14. 背景:background 复合属性
  15. background:color image repeat position;
  16. background-color 背景色
  17. background-image:url("路径") 背景图
  18. background-repeat 背景平铺
  19. no-repeat 不平铺
  20. repeat-x 横向平铺
  21. repeat-y 纵向平铺
  22. repeat 平铺
  23. background-size 背景尺寸
  24. cover 全覆盖
  25. contain 当前盒子最大等比例放大
  26. background-position:x轴 y轴; 背景位置
  27. center left right bottom top
  28. */
  29. width: 800px;
  30. height: 800px;
  31. background: yellow url("../day1/images/img01.gif") no-repeat center;
  32. /* background-size: contain; */
  33. /* background-repeat: repeat; */
  34. /* background-color: aqua; */
  35. /* background: hotpink; */
  36. /* background-position: right bottom; */
  37. /* border: 1px solid #000; */
  38. /* 边框尺寸 */
  39. border-width: 10px;
  40. /* 边框样式
  41. solid 实线
  42. dashed 虚线
  43. double 双边框
  44. dotted 点线
  45. */
  46. border-style: dotted;
  47. /* 边框颜色 */
  48. border-color: red;
  49. /* 复合属性:
  50. border: width style color;
  51. border-top 上边框
  52. border-bottom 下边框
  53. border-right 右边框
  54. border-left 左边框
  55. */
  56. border: 2px solid blue;
  57. /* 相同样式后面的样式层级会覆盖前面的样式层级 */
  58. border-top: 5px dotted red;
  59. }
  60. </style>
  61. </head>
  62. <body>
  63. <div></div>
  64. </body>
  65. </html>