CSS背景放置和div放置 [英] CSS background placement and div placement

查看:86
本文介绍了CSS背景放置和div放置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在兼顾客户的项目。它位于: http://lp-com.appspot.com/


我从其中一个免费网站上从网上复制了这个模板,但我不太了解CSS以挽救我的生命!所以我需要帮助。您可以在主页面上看到nav div正下方是我的导航列表,然后是一个清晰的div,后面是绿色和灰色框。


在主页面上,背景图像只是在哪里我想要它。在导航链接的正下方,几乎是死屏中心。但是如果您查看about或者联系我们页面,您可以看到背景图像是如何被推下去的,因为绿色框的长度会影响格式化。


我希望看到的是背景图像保持在主屏幕上,但绿色和灰色框只是延伸到背景的底部边缘。因此,这将推动W3C检查员和广告更进一步。


我如何在CSS中做到这一点?

解决方案

是否添加到#gbox''position''解决问题?


确实如此,但它会覆盖下面的所有其他内容。验证检查器链接和广告受到gbox的阻碍。


您可以将#gbox包装到绝对层中,并将验证检查器和广告放到该新绝对层的底部(在其中)

I''ve been working on a project for a customer part time. It''s located here: http://lp-com.appspot.com/

I copied this template from the web from one of those free sites but I don''t know enough about CSS to save my life! So I need help. You can see on the main page that right below the nav div is my navigation list then a clear div followed by the green and grey boxes.

On the main page the background image is just where I want it. Right below the nav links, pretty much dead center of the screen. But if you look at the about or contact us page you can see how the background image is being pushed down farther because of the length of the green box, which messes up the formatting.

What I would like to see is the background image stay put like it is on the main screen but the green and grey boxes just extend beyond the bottom edge of the background. This would therefore push the W3C checkers and the adverts down farther.

How do I do that in CSS?

解决方案

Does adding to #gbox ''position:absolute'' solve the problem?


It does, but then it covers up everything else that is down below. The validation checker links and the adverts are obstructed by the gbox.


Can you wrap #gbox into absolute layer and put validation checker and adverts to the bottom of that new absolute layer (within it).


这篇关于CSS背景放置和div放置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆