0
点赞
收藏
分享

微信扫一扫

浮动特性(重难点)——脱标

点亮自己的那盏灯 2022-04-01 阅读 39
htmlcss

代码:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <style>
          
          .box1{
                float: left;
                width:  200px;
                height: 200px;
                background-color: pink;
          }

          .box2{
                width:  300px;
                height: 300px;
                background-color: rgb(0, 153, 255)
          }
          
    </style>
</head>

<body>
        <div class="box1">浮动的盒子</div>
        <div class="box2">标准流的盒子</div> 
</body>

</html>

运行效果

 加上浮动的盒子会浮动半空中,位置不在保留

如果另一个盒子没有加上浮动,会跑到底下

举报

相关推荐

0 条评论