css浮动案例

效果图

 代码

<!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>
      .box {
        width: 1226px;
        height: 614px;
        background-color: pink;
        margin: 0 auto;
      }
      .left {
        float: left;
        width: 234px;
        height: 614px;
        background-color: purple;
      }
      .right {
        float: left;
        width: 992px;
        height: 614px;
        background-color: skyblue;
      }
      /* 亲子鉴定选择器(只选儿子) */
      .right > div {
        float: left;
        width: 234px;
        height: 300px;
        background-color: pink;
        margin-left: 14px;
        margin-bottom: 14px;
      }
    </style>
  </head>
  <body>
    <div class="box">
      <div class="left">left</div>
      <div class="right">
        <div>1</div>
        <div>2</div>
        <div>3</div>
        <div>4</div>
        <div>5</div>
        <div>6</div>
        <div>7</div>
        <div>8</div>
      </div>
    </div>
  </body>
</html>

 

posted @ 2021-12-13 20:33  谁有大饼  阅读(55)  评论(0)    收藏  举报