html如何将页面分成三列,纯CSS实现的三列布局网页效果实例

本文提供了一个使用纯CSS布局的三列网页示例,包括头部、中间、三列布局、导航条和底部。通过设置div的相对和绝对定位,实现了200px固定宽度的侧边栏、240px右侧栏和自适应内容的中心栏。同时,文章还展示了导航菜单和列表项的样式设计,有助于理解CSS在网页布局中的应用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

本文实例讲述了纯CSS实现的三列布局网页效果。分享给大家供大家参考。具体分析如下:

这是一个比较常用的用DIV+CSS布局的网页,包括头部、中间、一行三列布局、导航条、页面底部等,如果你正在用CSS布局一个网页,那么这段代码正好你能用得上,这种布局方式现在比较常用。

复制代码代码如下:

一个常用的纯CSS布局的网页

*{

font-size:12px;

font-family:verdana;

margin:0px;

padding:0px;

}

a{

text-decoration:none;

}

#header,#footer{

width:85%;

margin:0 auto;

height:50px;

}

#header{

height:70px;

margin-top:5px;

border:solid 1px #000;

background:url() no-repeat right -20px;

}

#header h1{

line-height:40px;

}

#body{

position:relative;

width:85%;

margin:3px auto;

height:100%;

word-wrop:break-word;

word-break:break-all;

}

#sidebar{

position:absolute;

left:0;

top:0;

width:200px;

}

#right{

width:240px;

position:absolute;

right:0;

top:0;

}

#center{

margin:0 241px 0 201px;

}

#body,#sidebar,#right,#center,#footer{height:750px;border:solid 1px #000;}

#footer{

height:50px;

}

#body{

border:none;

}

#nav ul{

float:left;

width:600px;

list-style-type:none;

border-bottom:solid 6px #6666CC;

}

#nav ul li{

float:left;

}

#nav li a{

display:block;

text-decoration:none;

text-align:center;

width:50px;

padding:5px;

}

#nav li a:hover{

background:#66c;

color:#fff;

font-weight:bold;

}

dt{

border-bottom:dotted 1px #000066;

border-top:dotted 1px #006;

}

dt.first{

border-top:none;

}

dt{

padding:8px 0px 8px 4px;

}

dd a{

display:block;

text-indent:20px;

padding:10px;

}

dd a:hover{

font-weight:bold;

color:#000;

background:#66FFCC;

}

center

希望本文所述对大家的div+css网页设计有所帮助。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值