我想要放置兩列三個垂直DIV的並排。左欄是主文本區域,右欄是misc信息。 每列的頂部和底部DIV只是一個帶圓角的圖像。中心DIV用於文本。此外,我理想地喜歡每列中的中心DIV與文本內容成比例地自動垂直擴展。兩列三個DIV的每個
以下是我的CSS:
.main_bkgd_tp_img {
background: url(../images/text.main.tp.gif);
float:left;
width: 400px;
height: 20px;
}
.main_bkgd_btm_img {
background: url(../images/text.main.btm.gif);
float:left;
width: 400px;
height: 20px;
}
.mainbody {
background: url(../images/text.main.fill.gif);
position:relative;
float:left;
width: 400px;
height: 300px;
}
.mainbody .text {
position:absolute;
top:10px;
left:20px;
width:95%;
}
.mainbody p {
position:relative;
font:normal 12px verdana, arial, helvetica, sans-serif;
color:#000;
line-height:15px;
}
.mainbody h1, h2 {
position:relative;
color:#000;
line-height:15px;
}
.rtcol_bkgd_tp_img {
background: url(../images/rtcol.main.tp.gif);
float:right;
width: 100px;
height: 20px;
}
.rtcol_bkgd_btm_img {
background: url(../images/rtcol.main.btm.gif);
float:right;
width: 100px;
height: 20px;
}
.rtcolbody {
background: url(../images/rtcol.main.fill.gif);
position:relative;
float:right;
width: 100px;
height: 300px;
}
.rtcolbody .text {
position:absolute;
top:10px;
right:20px;
width:95%;
}
.rtcolbody p {
position:relative;
font:normal 12px verdana, arial, helvetica, sans-serif;
color:#000;
line-height:15px;
}
.rtcolbody h1, h2 {
position:relative;
color:#000;
line-height:15px;
}
而以下是我的HTML:
<div class="main_bkgd_tp_img"></div>
<div class="mainbody">
<div class="text">
<h4> This is made up text just for testing purposes. The real text will be added later.</h4>
<h4> This is more made up text just for testing purposes. The real text will be added later. </h4>
</div>
</div>
<div class="main_bkgd_btm_img"></div>
<div class="rtcol_bkgd_tp_img"></div>
<div class="rtcolbody">
<div class="text">
<h4> This is a test. </h4> <br/>
<h4>This text is just for testing purposes. The real text will be added later. </h4>
</div>
</div>
<div class="rtcol_bkgd_btm_img"></div>
過程中的實際頁面可以看到here。
謝謝!
我相信我明白了這一點。 對於每個「rtcol _....」CSS條目,我將「float:right」更改爲「margin-left:420px。
我仍然需要知道如何使中間DIV自動與!文本內容
感謝
歡迎來到StackOverflow!爲了將來的參考,用四個空格縮進代碼將會很漂亮地打印它。 – Dennis 2012-04-23 00:40:11
你想支持哪些瀏覽器?您可以使用CSS創建圓角。 – 2012-04-23 03:19:29