17_盒模型.html 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. /* * 通配符 选中所有元素 */
  10. *{
  11. margin:0;
  12. padding: 0;
  13. }
  14. #div1{
  15. width: 200px;
  16. height: 200px;
  17. background: #f00;
  18. /* 内边距 内容和边框之前的距离 */
  19. /* padding:20px; */
  20. /* 上右下左 */
  21. /* padding:10px 20px 30px 40px; */
  22. /* 上下 左右 */
  23. /* padding: 20px 40px; */
  24. /* 边框: 粗细 实线solid |虚线 dashed 颜色*/
  25. /* border:5px solid black; */
  26. /* 外边距 边框以外的距离*/
  27. /* margin:100px; */
  28. /* margin:10px 20px; */
  29. /* margin:10px 20px 30px 40px ; */
  30. /* left right top bottom 可以单独设置上下左右 */
  31. /* padding-top:30px; */
  32. /* margin-top:40px; */
  33. }
  34. </style>
  35. </head>
  36. <body>
  37. <div id="div1">
  38. 哈哈哈哈
  39. </div>
  40. <ul>
  41. <li>111</li>
  42. <li>111</li>
  43. <li>111</li>
  44. </ul>
  45. <p>dhjshjfdgshfgj</p>
  46. </body>
  47. </html>