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

网页设计中用DIV排版,到底是怎么样控制好DIV的属性,达到自己想要的效果?

答案:楼上的真是喜欢装,还贴代码,就这代码能说明什么??? 用div排版最重要的当然是要做到各个浏览器的兼容,写样式的时候必须遵照css hack的写法!!
其他:这是我用的body属性,很好用的,很难出错。

body{margin:0 auto; width:980px;}(宽度是必要的,如果您想不写也可以就不能居中了。宽度是根据您的网页宽度来写的。)
margin,padding{margin:0; padding:0;}
dt,dl,dd,p,ul,li,form,input,h3,h4,span,p,storg{margin:0; margin:0px; padding:0px; border:0;}
a, a:link { color: #000; text-decoration: none; }
a:visited {  }
a:active, a:hover { text-decoration: none; }
a:focus { outline: none; }
img{border:0;border: 0 none; vertical-align: top}
clear{clear:both; height:0; overflow:hidden; font-size:0; display:inline;}
h1,h2,h3,h4,h5,h6{font-weight:bold; font-size:12px; font-family:"宋体";}
ul,li{list-style:none;}
:focus {-moz-outline-style: none; }  for Firefox   
.unline,.unline a{text-decoration:underline}
.nounline,.nounline a,.list12 .nounline{text-decoration:none}
.left{float:left;}
.right{float:right;}
.clear{clear:both;}/*ie and firefox1.5 updata */
.txtLeft{text-align:left}
.txtright{text-align:right}
.txtCenter{text-align:center}
.show{display:block}
.hidden{display:none}
.hand{cursor:pointer;}
.fontArial{font-family:'Arial';}
.b{font-weight:bold;}
input,button,textarea,select{ font: 12px/26px "宋体",Arial;color:#797779;}
.clear{clear:both;font-size:0px;height:0px;line-height:0px;overflow:hidden;} 多设计几个div,把大的div宽指定好了之后,使左右两边的div宽高不要超过最大的div的宽,尽量不要使用margin-left;margin-right去对齐,那样div容易错位。 学好CSS 空间结构要强,
两个模块的衔接要准确。 

上一个:<div>:<span class="red">{:sys_format_price($value[price])}</span> </div> 请问是什么意思
下一个:div class="grid" 是什么意思

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