4_基础样式.html 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <title>Document</title>
  8. <style>
  9. #div1 {
  10. /* 宽高 */
  11. width: 1200px;
  12. height: 800px;
  13. /* 背景 */
  14. /* background: red; */
  15. background-color: red;
  16. background-image: url(../images/img01.jpeg);
  17. /* repeat|no-repeat */
  18. background-repeat: no-repeat;
  19. /* 背景图片位置 水平(固定值|left|center|right) 垂直(固定值|top |center|bottom) */
  20. /* background-position: -100px 200px ; */
  21. background-position: center top ;
  22. /* 简写 */
  23. background: red url(../images/img01.jpeg) no-repeat center top ;
  24. }
  25. #div2{
  26. width: 300px;
  27. height: 50px;
  28. background: red;
  29. /* 字体相关属性 */
  30. /* 字体大小 最小12px 默认大小16*/
  31. font-size:25px;
  32. /* 字体粗细 100 -900 默认值400|normal bold|700 */
  33. font-weight:200 ;
  34. /* 字体 */
  35. font-family:Microsoft YaHei,Heiti SC,tahoma,arial,Hiragino Sans GB,"\5B8B\4F53",sans-serif;
  36. /* 样式 风格 italic|normal */
  37. font-style: normal;
  38. }
  39. </style>
  40. </head>
  41. <body>
  42. <!-- <div id="div1">1111111</div> -->
  43. <div id="div2">我是一个DIV</div>
  44. </body>
  45. </html>