我的母版页底部和右侧有空白区域。我可以“居中”吗?我的主页并设置背景图片?
Here's how it looks like right now:
Is there a way for me to center the area that has content, and place a repeating background image so the site doesn't look so empty?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
水平居中可以通过将要居中的内容包装在 div 中并将 style: 应用
到该 div 来实现。
这将解决右侧空间的问题。您也可以使用 CSS 放置背景图像(重复或不重复)。
您更大的问题将是垂直居中。据我所知,(目前)没有简单的跨浏览器(包括 IE6/7)方法来实现这一点。不过,我想被另一个用户证明是错误的。 :)
Centering horizontally can be accomplished by wrapping the content you wish to center in a div, and applying the style:
to said div.
This will take care of your issue of space on the right. You can place a background image (repeating or not) using CSS as well.
Your larger issue will be the vertical centering. As far as I'm aware, there's (currently) no easy, cross-browser (including IE6/7) way of accomplishing that. I'd like to be proven wrong here by another user, though. :)
在我看来,您只需要在内容区域的顶部和左侧添加一些填充。抱歉,我没有意识到您的页面只是屏幕的一部分。
为什么不将您的网站拼接成多个部分(div)并使用流畅的布局? 这是一篇来自 Smashing Magazine 的文章,介绍固定布局与流动布局。
It looks to me like you just need some padding on the top and left in your content area.Sorry I didn't realize your page was only a portion of the screen.
Why not splice your site into parts (divs) and use a fluid layout? Here is an article from Smashing Magazine about Fixed vs Fluid layouts.