//贴上代码

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <title></title>
        <style>
            .box1{    
                width:300px;
                height:300px;
                background-color: red;    
            }
            .box2{
                float:right;
                width: 200px;
                height:200px;
                background-color: green;
            }
            .box3{
                width:100px;
                height:100px;
                background-color: blue;
            }
        </style>
    </head>
    <body>
        <div class="box1">
            <div class="box2">    
                <div class="box3">
                </div>
            </div>    
        </div>        
    </body>
</html>

结果如图所示

关于html中,嵌套多个盒子浮动的问题。

 

 /*由此得出结论,当给box2设置右浮动时,box2里面的box3盒子并不会继承浮动属性*/

相关文章:

  • 2021-06-06
  • 2022-12-23
  • 2021-05-29
  • 2021-05-22
  • 2021-08-19
  • 2022-12-23
  • 2022-12-23
  • 2021-07-06
猜你喜欢
  • 2022-12-23
  • 2021-11-27
  • 2021-12-09
  • 2021-10-04
  • 2021-12-10
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案