视频:https://www.bilibili.com/video/BV1pE411q7FU?p=181&spm_id_from=pageDriver
    image.png
    image.png
    image.png
    例子

    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. margin: 0;
    11. padding: 0;
    12. }
    13. .top {
    14. height: 40px;
    15. background-color: #333;
    16. }
    17. .banner {
    18. width: 1000px;
    19. height: 300px;
    20. background-color: red;
    21. margin: 10px auto;
    22. }
    23. .box {
    24. width: 1000px;
    25. height: 200px;
    26. background-color: blue;
    27. margin: 0 auto;
    28. }
    29. li {
    30. list-style: none;
    31. }
    32. .box ul li {
    33. width: 235px;
    34. height: 200px;
    35. background-color: pink;
    36. float: left;
    37. margin-right: 20px;
    38. }
    39. .box ul .last {
    40. margin-right: 0;
    41. }
    42. .footer {
    43. margin-top: 10px;
    44. height: 200px;
    45. background-color: #333;
    46. }
    47. </style>
    48. </head>
    49. <body>
    50. <div class="top"></div>
    51. <div class="banner"></div>
    52. <div class="box">
    53. <ul>
    54. <li>1</li>
    55. <li>2</li>
    56. <li>3</li>
    57. <li class="last">4</li>
    58. </ul>
    59. </div>
    60. <div class="footer"></div>
    61. </body>
    62. </html>

    image.png