满屏品字布局

思路:上面的div宽100%,下面的两个div分别宽50%,然后用float或者inline使其不换行即可。

<div class="header">头部</div>
<div class="left"></div>
<div class="right"></div>
.header,.left,.right{height: 300px;}
.header{width: 100%;background-color: yellow;}
.left{float: left;width: 50%;background-color: #09f;}
.right{float: left;width: 50%;background-color: red;}

 品字布局

 

局部品字布局:

左右在排版时要反过来,不然不出效果

<div class="top"></div>
<div class="right"></div>
<div class="left"></div>
.top, .left, .right{height: 100px;width: 100px;}
.top{margin: 0 auto; background-color: #FF0000;}
.left{float: left;margin-left: -200px;background-color: yellow;}
.right{float: left;margin-left: 50%;background-color: blue;}

品字布局

 

相关文章:

  • 2021-12-14
  • 2021-05-29
  • 2021-07-08
  • 2021-04-08
  • 2021-08-24
  • 2021-05-28
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-22
  • 2021-10-18
  • 2022-12-23
  • 2022-12-23
  • 2021-11-25
相关资源
相似解决方案