首页 > Web开发 > 详细

实现圣杯布局的 css 方案

时间:2020-02-17 22:20:11      阅读:68      评论:0      收藏:0      [点我收藏+]

实现圣杯布局的 css 方案

float 实现

<div class="float">
    <div class="left"></div>
    <div class="right"></div>
    <div class="center"></div>
</div>
.left {
    float: left;
}
.right {
    float: right;
}

 

position 实现

<div class="layout">
    <div class="left"></div>
    <div class="center"></div>
    <div class="right"></div>
</div>
.layout {
    position: relative;
}

.left {
    background-color: red;
    position: absolute;
    width: 200px;
    left: 0;
    top: 0;
}

.right {
    background-color: red;
    position: absolute;
    width: 200px;
    right: 0;
    top: 0;
}

.center {
    background-color: skyblue;
    left: 200px;
    right: 200px;
    top: 0;
}

 

table 实现

<div class="layout">
    <div class="left"></div>
    <div class="center"></div>
    <div class="right"></div>
</div>
.layout div {
    height: 200px;
    display: table-cell;
}

.left, .right {
    width: 200px;
    background: red;
}

.center {
    background: skyblue;
}

实现圣杯布局的 css 方案

原文:https://www.cnblogs.com/sosoyi/p/12323752.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!