<div class="top">
    <div class="left">欢迎来到!</div>
    <div class="right">登录|注册</div>
</div>


.top .left{
    float: left;
}
.top .right{
    float: right;
}
.top:after{     //
    content:"";
    height:0px;
    width:0px;
    clear:both;
    display:block;
    overflow: hidden;
}

另外两种清除浮动:1.父盒用overflow:hidden;(有局限)     2. 添加 空的div,设置样式clear:both;

相关文章:

  • 2022-12-23
  • 2021-09-05
  • 2022-12-23
  • 2021-09-08
  • 2021-08-29
  • 2021-07-12
猜你喜欢
  • 2021-08-15
  • 2022-12-23
  • 2021-07-20
  • 2022-01-10
相关资源
相似解决方案