[英]Setting background-color property just for the centered body
I would like to know how to change the background-colour, but just of the center of the body. 我想知道如何改变背景色,但只是改变身体的中心色。 How is that possible? 那怎么可能?
html {
display: table;
margin: auto;
background-color: white;
}
body {
background-color: white;
}
The background-color command here is changing the colour of the whole website. 此处的background-color命令正在更改整个网站的颜色。
Thanks in advance 提前致谢
So your question is quite vague so I'm not entirely sure I know what you're asking. 因此,您的问题非常模糊,因此我不确定我是否知道您的要求。
BUT - What I think you're asking for is this... http://jsfiddle.net/x6kVH/ 但是-我想您要问的是这个... http://jsfiddle.net/x6kVH/
What you'd need to do is create a container to put your content inside 您需要做的是创建一个容器,将内容放入其中
<div id="container">
<!-- ALL CONTENT GOES IN HERE -->
</div>
#container {
width: 300px;
height: 700px;
background:
#ff0000;
margin: 0 auto;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.