当前位置:编程学习 > html/css >>

一个网站,在css中怎样设置div的样式。div分上中下,并且中间分左右部分。谢谢各位高手了!

答案:<!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>

上一个:div绝对定位:想新建一个div遮盖住网站底部的版权,他的css属性该怎么写?菜鸟求助,用绝对定位吗?
下一个:问下div css怎么做网站的边框圆角?

CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,