网页css居中

来源:百度知道 编辑:UC知道 时间:2024/06/10 11:22:06
那部份是控制居中的代码
谢谢
.BODY2 {
SCROLLBAR-FACE-COLOR: #83bde3; MARGIN: 0px; SCROLLBAR-HIGHLIGHT-COLOR: #83bde3; SCROLLBAR-SHADOW-COLOR: #084369; SCROLLBAR-ARROW-COLOR: #084369; SCROLLBAR-TRACK-COLOR: #83bde3;SCROLLBAR-DARKSHADOW-COLOR: #83bde3; SCROLLBAR-BASE-COLOR: #83bde3;font-family:宋体; margin:1px; padding:0px; background-color: #9AD0EB; color: #000000; font-weight: normal; font-size: 9pt; font-style: normal; text-decoration: none; font-family: 宋体; border:0px;
}

body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
background-color: #EEF9FC;
font-size: 12px;
}
td{font-size:12px}
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
}
a:hover {
text-decoration: none;
}
a:active {
text-decoration: none;
}.top_1 {
color: #006699;
font-size: 12px;
text-decoration: none;
}
.loginform {

好像是没有...你要居中 直接把代码写在
<center>
你的代码
</center>
就成了....

或者在body这个标签下建立一个总的标签
<body>
<div style="width:960px; margin:0 auto;"><!--这里宽度一定要设置-->
你的代码
</div>
</body>

就居中了

看来你对css不怎么了解
一般情况下设置margin:0 auto;就是居中
margin-left: 0px;
margin-right: 0px; 也可以达到居中的效果
但是它旁边或上级标签设置padding,margin,width后都会影响到居中效果 可能就不居中了
没有绝对的居中样式 都是慢慢调出来的
margin就是设置上右下左的距离的 设置任何margin属性后都会影响控件的页面布局

margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;

MARGIN: 0px; 左右空白自动 就是居中