4_css基础语法1.html 996 B

12345678910111213141516171819202122232425262728293031323334353637
  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. /* 1取到这个元素 */
  10. div{
  11. width:600px;
  12. height:350px;
  13. /* 背景复合属性 颜色 背景图片 */
  14. /* background: red; */
  15. background-color:red ;
  16. background-image: url(img02.jpg);
  17. /* 背景图片重复 repeat(默认) |no-repeat*/
  18. background-repeat:no-repeat ;
  19. /* 背景位置 水平 垂直 (一种方式可以用固定单位 二种水平:left center right 垂直: top center bottom) */
  20. background-position:200px -100px;
  21. /*合并 简化为 */
  22. /* background:red url(img02.jpg) no-repeat left center; */
  23. }
  24. </style>
  25. </head>
  26. <body>
  27. <div>111</div>
  28. </body>
  29. </html>