你可以用这种方法浮动做到这一点:
#photos-main {
float: left;
width: 800px;
}
#panel {
float: right; /*to have the panel on the right side*/
width: 100px; /*with a width of 100px*/
}
然后你必须包装在两个标签与另一个,这让这两个元素的总宽度。
要澄清这两列的布局,并把例如一个脚注在下面,把另一个放在你的HTML-Structure中,并设置成简单的css“clear:both;”,这样浮动就会停止。
完全样本
HTML
<div id="wrap">
<div id="photos-main"></div>
<div id="panel"></div>
<div id="clear"></div>
</div>
CSS
#wrap {
width: 900px;
}
#photos-main {
float: left;
width: 800px;
}
#panel {
float: right; /*to have the panel on the right side*/
width: 100px; /*with a width of 100px*/
}
#clear {
clear:both;
}