简体   繁体   English

CSS两列布局,具有恒定的侧边栏宽度

[英]CSS two column layout with constant sidebar width

How do I define a design using div s (or html5 section ) 如何使用div (或html5 section )定义设计

| | content - fill the area | 内容 - 填写区域| < gap 20px > |sidebar width 200px sticks to the right | <gap 20px> |侧边栏宽度200px贴在右侧|

Write like this: 像这样写:

div{
    height:80px;
    background:red;
}
.fixed{
    float:right;
    margin-left:20px;
    width:200px;
}
.dynamic{
    background:green;
    overflow:hidden;
}

Check this http://jsfiddle.net/gtmXE/ 检查这个http://jsfiddle.net/gtmXE/

<div id="sidebar" style="float:right; width:200px;">
<div id="content" style="margin-right:220px">
    main content
</div>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM