CSS常用網(wǎng)站布局實(shí)例
以下是引用片段:
body { margin: 0px; padding: 0px; text-align: center; }
#content { margin-left:auto; margin-right:auto; width: 400px; width: 370px; }
兩行一列
以下是引用片段:
body { margin: 0px; padding: 0px; text-align: center;}
#content-top { margin-left:auto; margin-right:auto; width: 400px; width: 370px;}
#content-end {margin-left:auto; margin-right:auto; width: 400px; width: 370px;}
三行一列
以下是引用片段:
body { margin: 0px; padding: 0px; text-align: center; }
#content-top { margin-left:auto; margin-right:auto; width: 400px; width: 370px; }
#content-mid { margin-left:auto; margin-right:auto; width: 400px; width: 370px; }
#content-end { margin-left:auto; margin-right:auto; width: 400px; width: 370px; }
單行兩列
以下是引用片段:
#bodycenter { width: 700px;margin-right: auto; margin-left: auto;overflow: auto; }
#bodycenter #dv1 {float: left;width: 280px;}
#bodycenter #dv2 {float: right;width: 410px;}
兩行兩列
以下是引用片段:
#header{ width: 700px; margin-right: auto;margin-left: auto; overflow: auto;}
#bodycenter { width: 700px; margin-right: auto; margin-left: auto; overflow: auto; }
#bodycenter #dv1 { float: left; width: 280px;}
#bodycenter #dv2 { float: right;width: 410px;}
三行兩列
以下是引用片段:
#header{ width: 700px;margin-right: auto; margin-left: auto; }
#bodycenter {width: 700px; margin-right: auto; margin-left: auto; }
#bodycenter #dv1 { float: left;width: 280px;}
#bodycenter #dv2 { float: right; width: 410px;}
#footer{ width: 700px; margin-right: auto; margin-left: auto; overflow: auto; }
單行三列
絕對(duì)定位
以下是引用片段:
#left { position: absolute; top: 0px; left: 0px; width: 120px; }
#middle {margin: 20px 190px 20px 190px; }
#right {position: absolute;top: 0px; right: 0px; width: 120px;}
float定位一
xhtml:
以下是引用片段:
<div id="warp">
<div id="column">
<div id="column1">這里是第一列</div>
<div id="column2">這里是第二列</div>
<div class="clear"></div>
</div>
<div id="column3">這里是第三列</div>
<div class="clear"></div>
</div>
CSS:
以下是引用片段:
#wrap{ width:100%; height:auto;}
#column{ float:left; width:60%;}
#column1{ float:left; width:30%;}
#column2{ float:right; width:30%;}
#column3{ float:right; width:40%;}
.clear{ clear:both;}
float定位二
xhtml:
以下是引用片段:
<div id="center" class="column">
<h1>This is the main content.</h1>
</div>
<div id="left" class="column">
<h2>This is the left sidebar.</h2>
</div>
<div id="right" class="column">
<h2>This is the right sidebar.</h2>
</div>
CSS:
以下是引用片段:
body {margin: 0;padding-left: 200px;padding-right: 190px;min-width: 240px;}
.column {position: relative;float: left;}
#center {width: 100%;}
#left {width: 180px; right: 240px;margin-left: -100%;}
#right {width: 130px;margin-right: -100%;}
兩行三列
xhtml:
以下是引用片段:
<div id="header">這里是頂行</div>
<div id="warp">
<div id="column">
<div id="column1">這里是第一列</div>
<div id="column2">這里是第二列</div>
<div class="clear"></div>
</div>
<div id="column3">這里是第三列</div>
<div class="clear"></div>
</div>
CSS:
以下是引用片段:
#header{width:100%; height:auto;}
#wrap{ width:100%; height:auto;}
#column{ float:left; width:60%;}
#column1{ float:left; width:30%;}
#column2{ float:right; width:30%;}
#column3{ float:right; width:40%;}
.clear{ clear:both;}
三行三列
xhtml:
以下是引用片段:
<div id="header">這里是頂行</div>
<div id="warp">
<div id="column">
<div id="column1">這里是第一列</div>
<div id="column2">這里是第二列</div>
<div class="clear"></div>
</div>
<div id="column3">這里是第三列</div>
<div class="clear"></div>
</div>
<div id="footer">這里是底部一行</div>
CSS:
以下是引用片段:
#header{width:100%; height:auto;}
#wrap{ width:100%; height:auto;}
#column{ float:left; width:60%;}
#column1{ float:left; width:30%;}
#column2{ float:right; width:30%;}
#column3{ float:right; width:40%;}
.clear{ clear:both;}
#footer{width:100%; height:auto;}
相關(guān)文章
Javascript Event事件中IE與標(biāo)準(zhǔn)DOM的比較
說(shuō)是IE與DOM的比較,其實(shí)還是瀏覽器之間的比較,眾多的瀏覽器中,IE獨(dú)樹(shù)一幟,并且占有大部分用戶市場(chǎng),后來(lái)的標(biāo)準(zhǔn)DOM雖然不少優(yōu)點(diǎn)之處,但畢竟一般用戶不關(guān)心也不知道這些,代碼編寫(xiě)過(guò)程中,往往需要兼顧多個(gè)瀏覽器。2010-04-04uni-app動(dòng)態(tài)修改導(dǎo)航欄標(biāo)題簡(jiǎn)單步驟
uniapp作為一款開(kāi)源軟件,可以做到一端多用,不過(guò)也有局限,在開(kāi)發(fā)中有時(shí)候需要?jiǎng)討B(tài)的去修改標(biāo)題,下面這篇文章主要給大家介紹了關(guān)于uni-app動(dòng)態(tài)修改導(dǎo)航欄標(biāo)題的相關(guān)資料,需要的朋友可以參考下2023-06-06使用Promise和JavaScript有效處理1000個(gè)請(qǐng)求的方法
在現(xiàn)代Web開(kāi)發(fā)中,處理高并發(fā)請(qǐng)求是一個(gè)常見(jiàn)的挑戰(zhàn),當(dāng)我們需要從服務(wù)器獲取大量數(shù)據(jù)或執(zhí)行多個(gè)異步任務(wù)時(shí),如何有效地管理請(qǐng)求的并發(fā)性和性能變得至關(guān)重要,本文將介紹如何使用Promise和JavaScript來(lái)管理高并發(fā)請(qǐng)求,需要的朋友可以參考下2023-09-09小程序自定義單頁(yè)面、全局導(dǎo)航欄的實(shí)現(xiàn)代碼
這篇文章主要介紹了小程序自定義單頁(yè)面、全局導(dǎo)航欄的實(shí)現(xiàn)代碼,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2019-03-03優(yōu)雅而高效的JavaScript?try...catch語(yǔ)句詳解(js異常處理)
這篇文章主要給大家介紹了關(guān)于JavaScript中try...catch語(yǔ)句的相關(guān)資料,也就是js異常處理方法,try...catch是JavaScript中的錯(cuò)誤處理機(jī)制,它的作用是捕獲和處理可能發(fā)生的錯(cuò)誤,以避免程序崩潰,需要的朋友可以參考下2024-01-01BootStrap點(diǎn)擊下拉菜單項(xiàng)后顯示一個(gè)新的輸入框?qū)崿F(xiàn)代碼
這篇文章主要介紹了BootStrap點(diǎn)擊下拉菜單項(xiàng)后顯示一個(gè)新的輸入框?qū)崿F(xiàn)代碼的相關(guān)資料,需要的朋友可以參考下2016-05-05如何基于JS實(shí)現(xiàn)Ajax并發(fā)請(qǐng)求的控制詳解
通常為了減少頁(yè)面加載時(shí)間,先把核心內(nèi)容顯示處理,頁(yè)面加載完成后再發(fā)送ajax請(qǐng)求獲取其他數(shù)據(jù),這時(shí)就可能產(chǎn)生多個(gè)ajax請(qǐng)求,為了用戶體驗(yàn),最好是發(fā)送并行請(qǐng)求,這篇文章主要給大家介紹了關(guān)于如何基于JS實(shí)現(xiàn)Ajax并發(fā)請(qǐng)求控制的相關(guān)文章,需要的朋友可以參考下2021-08-08JS前端開(kāi)發(fā)模擬虛擬dom轉(zhuǎn)真實(shí)dom詳解
這篇文章主要為大家介紹了JS前端開(kāi)發(fā)模擬虛擬dom轉(zhuǎn)真實(shí)dom詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2023-01-01