日期:2014-05-17  浏览次数:20563 次

DIV+CSS一般用什么定位?
是不是外面用相对定位,里面用绝对定位?我可以简单的写一写,但是感觉没章法,很乱,功能倒可以实现,但是什么时候改用什么,还是不太懂,比如两个层的空隙,用absolute relative可以实现,用margin也可以实现,有没有规则呀,现在头很大,最好能详细系统的说一说:)
先谢谢各位了!

------解决方案--------------------
一般不设置定位,除非有特殊的要求
------解决方案--------------------
盒模型!

 一个两列的:
body 
{
margin:0px;
padding:0px;
}


/*块*/
.block
{
  border:solid 1px #6595D6;
 padding:1px ;
 margin:4px 1px 4px 1px;

}
/*块的标题样式*/
.block_header
{
background-color:#6595D6; /*块标题背景浅蓝色*/
height:1.5em; /*块标题的高度*/
padding-top:0.3em;/*让块标题文字居于标题区域的中间*/
color:White; /*块标题字体颜色为白色*/
font-size:12px;
font-weight: bold;
vertical-align:middle;
}



/*最底层的块,是其它块的容器,其宽度为800px,自动在浏览器中居中*/
#container
{
margin-left:auto;
margin-right:auto;
width:800px;
padding:0 0 0 0;
}

/*页面上端长条的区域,用于放置各种大幅的广告*/
#banner
{
clear:both; /*清除各种排版方法的影响*/
text-align:center;
background-image:url(Image/Banner.jpg);
width:100%;
color:Yellow;
font-size:30px;
  
 
}

/* 页面最底端的“脚注”部分*/
#footer
{
clear:both; /*清除各种排版方法的影响*/
text-align:center;
background-image:url(Image/Footer.jpg);
width:100%;
line-height:30px;
font-weight:bold ;
font-size:15px;
height:30px;

}

自己写个三列了 试试
------解决方案--------------------
看看xhtml+css布局的例子,你一下就明白了,用不了多长时间。
http://www.52css.com/article.asp?id=185
这个挺好。