国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 開發(fā) > CSS > 正文

左側(cè)固定寬度,右側(cè)自適應(yīng)寬度的CSS布局

2024-07-11 08:38:57
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

第一種方法:
關(guān)于這個(gè)布局,作者是這樣說(shuō)明的:“left和right都貼住左側(cè)。設(shè)置left在right上面(z-index);在right內(nèi)加個(gè)放內(nèi)容的層(content);設(shè)置content距離right的左側(cè)為200px,即剛巧等于left的寬度。”
這個(gè)布局有一個(gè)缺點(diǎn)就是,如果我設(shè)置了foot的div,試了很多辦法,都不能根據(jù)content的高度,連著中間的內(nèi)容,自動(dòng)置于HTML頁(yè)面的底部。如有牛人知道解決方法,望留言解答。


<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=gb2312″ />
<title></title>
<style type=”text/css”>
* {margin:0; padding:0; list-style:none; }
.header{ width:100%;height:250px;background-color:#33FF00;}
.logo{width:100%;height:200px;background-color:#330000;}
.nav{width:100%;height:50px;background-color:#660000;}
.wrapper {width: 100%; }
.left {width:200px; height:auto;background:#fcc; position:absolute; left:0;z-index:1;}
.right {width:100%; height:400px;background:#ccc; position:absolute; left:0;}
.content {height:400px;margin-left:200px; background:#ffc; }
.foot { position:absolute;height:100px;background-color:#000000;bottom:0;}
.foot h1, .foot p{color:#FFFFFF;}
</style>
</head>
<body>
<div class=”wrapper”>
<div class=”header”>
<div class=”logo”></div>
<div class=”nav”></div>
</div>
<div class=”left”>
<h1>Left</h1>
<p>左側(cè)固定寬度200px</p>
</div>
<div class=”right”>
<div class=”content”>
<h1>Content</h1>
<p>右側(cè)寬度自動(dòng)適應(yīng)</p>
</div>
</div>
<div class=”foot”>
<h1>Foot</h1>
<p>想看看他的位置會(huì)在哪?</p>
</div>
</div>
</body>
</html>

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 从江县| 武宁县| 巴青县| 万荣县| 海兴县| 凯里市| 北海市| 新竹市| 桃园县| 九龙坡区| 榆中县| 英德市| 光泽县| 元氏县| 东平县| 从江县| 永新县| 绥中县| 尚义县| 来凤县| 波密县| 遂宁市| 沂水县| 称多县| 宁乡县| 霍城县| 绥化市| 增城市| 巫山县| 凤翔县| 尼玛县| 通城县| 诸暨市| 寿阳县| 万源市| 蒙自县| 阿克苏市| 芷江| 衡山县| 贡觉县| 东兰县|