2.常用样式.html 2.9 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. 宽度 width
  10. 高度 height
  11. 单位 px
  12. 颜色 color
  13. 背景:background:color image repeat position; 复合属性
  14. 背景色:background-color
  15. 背景图:background-image:url("引入图片的路径")
  16. 背景是否平铺:background-repeat
  17. repeat 平铺
  18. repeat-x 横向平铺
  19. repeat-y 纵向平铺
  20. no-repeat 不平铺
  21. 背景尺寸:background-size
  22. cover 全覆盖
  23. contain 等比例放至最大
  24. 背景图位置:background-position:x y;
  25. center 中间
  26. left 左
  27. right 右
  28. top 上
  29. bottom 下
  30. 百分比及像素单位同时生效
  31. 背景图基点位置:background-origin
  32. border-box - 背景图片从边框的左上角开始
  33. padding-box -背景图像从内边距边缘的左上角开始(默认)
  34. content-box - 背景图片从内容的左上角开始
  35. 边框:border:width style color; 复合属性
  36. border-width:1px; 边框粗细
  37. border-color 边框颜色
  38. border-style 边框样式
  39. double 双边框
  40. dotted 点线
  41. solid 实线
  42. dashed 虚线
  43. 注:同标签 同级别 同样式 后面的样式会覆盖前面的样式
  44. */
  45. /* div {
  46. width:500px;
  47. height: 300px;
  48. border:10px dotted red;
  49. border-width: 3px;
  50. border-style: dashed;
  51. border-color: yellow;
  52. background: blue;
  53. background:url("../images/1.jpg");
  54. background-color: red;
  55. color: yellow;
  56. } */
  57. div {
  58. width: 1000px;
  59. height: 500px;
  60. padding: 200px;
  61. border: 3px solid #f00;
  62. background: url("../../day1/images/img01.jpeg");
  63. background-repeat: no-repeat;
  64. /* background-size: contain; */
  65. /* background-position: 100% 200px; */
  66. /* background-origin: border-box; */
  67. color: #f00;
  68. }
  69. </style>
  70. </head>
  71. <body>
  72. <div>
  73. <!-- <p>哈哈哈哈</p> -->
  74. <!-- <img src="../../day1/images/img01.jpeg" alt=""> -->
  75. </div>
  76. <!-- <img src="../images/1.jpg" style="width: 200px;height: 300px;" alt=""> -->
  77. </body>
  78. </html>