15_盒模型.html 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. width: 200px;
  11. height: 200px;
  12. background: #f00;
  13. /* 边框:粗细 solid实线|dashed虚线|dotted点 颜色 */
  14. /* transparent透明 */
  15. border:10px solid #000;
  16. /* 内边距 内容和边框之前的距离 */
  17. /* 上 右 下 左 */
  18. padding: 20px 30px 40px 50px;
  19. /* 外边距 边框意外的距离 ,一般用来调整两个元素之前的空隙 */
  20. /* margin:50px; */
  21. margin:50px 100px;
  22. }
  23. #div2{
  24. width: 200px;
  25. height: 200px;
  26. background: #00f;
  27. }
  28. </style>
  29. </head>
  30. <body>
  31. <div id="div1">
  32. 哈哈哈哈哈哈
  33. </div>
  34. <div id="div2">
  35. hehehehhehe
  36. </div>
  37. </body>
  38. </html>