我试图让my site的内容与其背景图片的中心完全对齐,有没有办法做到这一点?
目前我的背景是
body {
background: url(http://nickhumphries.com/images/tucson-bgl3b2.jpg) no-repeat center center fixed;
background-color: #fafafa;
-webkit-background-size: 100%;
-moz-background-size: 100%;
-o-background-size: 100%;
background-size: 100%;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
text-align:center;
}
#mainContainer {
margin:0 auto;
}
答案 0 :(得分:1)
因为你在它上面使用了div,所以你的身体不需要文本对齐中心。你应该使用#maincontainer作为类.maincontainer,这样你就可以单独重用它。
为什么你要同时使用100%尺寸和封面?你可以调整它以覆盖或保持100%正确吗?
玩这些想法。
答案 1 :(得分:0)
通常如果我想要居中,我会给它一个固定的宽度并将左边和右边的边距设置为自动