一个网站,在css中怎样设置div的样式。div分上中下,并且中间分左右部分。谢谢各位高手了!
发布网友
发布时间:2022-04-20 18:49
我来回答
共1个回答
热心网友
时间:2022-04-20 20:18
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>手写代码div+css</title>
<style type="text/css">
<!--
body{padding:0;margin:0;}
.clear{clear:both}
.box{width:900px;margin:0 auto;background:#CC6600;padding:0 50px;}
.top{height:120px;background:#3C9;}/*定义头部样式*/
.center{height:500px;background:#369;overflow:hidden;}/*定义体部样式*/
.page_left{width:200px;height:460px;float:left;background:#CC0;margin:20px 0 0 20px;display:inline;}/*定义体部左侧样式*/
.page_right{width:654px;height:460px;float:right;background:#F63;margin:20px 20px 0 0;display:inline;}/*定义体部右侧侧样式*/
.bottom{height:80px;background:#F9C;}/*定义尾部样式*/
-->
</style>
</head>
<body>
<div class="box">
<div class="top">头部层</div>
<div class="center">
<div class="page_left">体部左侧层</div>
<div class="page_right">体部右侧层</div>
</div>
<div class="clear"></div>
<div class="bottom">尾部层</div>
</div>
</body>
</html>