1.margin{top,right,bottom,left}

mangin:一个参教四个方向都会散变
二个参数第一个参数top, bottomi第二个参数Left,right
三个参数第一个top第二个参数might,left第三个参数bottom

  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. div {
  9. width: 100px;
  10. height: 100px;
  11. background-color: red;
  12. /*
  13. top, right, bottom,Left
  14. mangin:一个参教四个方向都会散变
  15. 二个参数第一个参数top, bottomi第二个参数Left,right
  16. 三个参数第一个top第二个参数might,left第三个参数bottom
  17. */
  18. margin: 100px 200px 300px 400px;
  19. }
  20. </style>
  21. </head>
  22. <body>
  23. <div>
  24. </div>
  25. </body>
  26. </html>

2.margin,border,padding,content

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        /* margin,borde,padding,content */
        div {
            width: 100px;
            height: 100px;
            background-color: red;
            margin-left: 10px;
            margin-top: 100px;
            border: 1px solid #333;
            /*top,right,bottom, right*/
            padding-left: 100px;
            padding-right: 100px;
        }
    </style>
</head>

<body>
    <div>

    </div>
</body>

</html>