侧边栏高度随中间内容高度自适应

  • 经常看见一个管理系统右侧边栏,要使得侧边高度随着和中间内容增多而增高。如图:

实现css代码:

    
/* 父元素 */
.wrap {
    overflow: hidden;
}
/* 左侧分栏 */
.left {
    width: 200px;
    background: #f00;
    float: left;
    margin-bottom: -3000px;
    padding-bottom: 3000px;
}
/*中间内容区域*/
.center {
    height: 500px;
    background: #00f;
    margin: 0 10px;
}

完整代码

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理