Html 我不能把尸体放在中间?
我有Html和Css标签。我的问题是我想把我的身体放在页面中央? 而且我也不想使用中心标签? 这是我的标签Html 我不能把尸体放在中间?,html,css,Html,Css,我有Html和Css标签。我的问题是我想把我的身体放在页面中央? 而且我也不想使用中心标签? 这是我的标签 body { background-image:url(../Image/bg1.jpg); margin:0; padding:0; padding-top:10px; } /*Header Start*/ .Header { background-color:red; width:801px; height:141px; } .
body {
background-image:url(../Image/bg1.jpg);
margin:0;
padding:0;
padding-top:10px;
}
/*Header Start*/
.Header {
background-color:red;
width:801px;
height:141px;
}
.Logo {
width:100px;
height:100px;
display:block;
}
.socialapp {
display:inline;
width:50px;
height:50px;
}
/*Header End*/
.content {
background-color:yellow;
width:800px;
height:1000px;
}
.footer {
background-color:green;
width:800px;
height:138px;
}
我的全部问题是身体标签!!
请帮助我你可以在你的身体标签上增加一些宽度。 添加
margin:auto
body {
background-image:url(../Image/bg1.jpg);
margin:0;
padding:0;
padding-top:10px;
width:800px;
margin:auto;
}
或
在body标签中创建包装div:
<body>
<div id="wrapper">
your header,content, footer etc code here...
</div>
</body>
#wrapper{
width:800px;
margin:auto;
}
html:
<body>
<div id="wrapper">
your header,content, footer etc code here...
</div>
</body>
#wrapper{
width:800px;
margin:auto;
}
在正文和页边空白处添加一个宽度您将
body
的宽度保留在auto
处,因此它将与窗口一样宽(好的,HTML元素,在本例中也是如此)。你希望它居中会有什么不同?