Rumah >hujung hadapan web >html tutorial >div+css 固定宽度且居中 文字左对齐_html/css_WEB-ITnose
方法一:
/* CSS Document */
body,html{
margin:0px;
padding:0px;
text-align:center;
background:#e9fbff;
}
#container{
position:relative;
margin:0px;
padding:0px;
width:700px; /*必须要有宽度否则无法对齐*/
text-align:left;
background:url(container_bg.jpg) repeat-y;
}
方法二:
/* CSS Document */
body,html{
margin:0px;
padding:0px;
background:#e9fbff;
}
#container{
position:relative;
left:50%;
width:700px;
margin-left:-350
margin:0px;
background:url(container_bg.jpg) repeat-y;
}
#banner{
margin:0px;
padding:0px;
}
#links{
font-size:12px;
margin:-18px 0px 0px 0px;
padding:0px;
position:relative;
}