如何摆脱差距与位置:相对横幅 [英] How to get rid of gap with position:relative banner

查看:168
本文介绍了如何摆脱差距与位置:相对横幅的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

推荐&最优雅的方式摆脱由位置造成的差距:相对?

What's the recommended & most elegant way of getting rid of the gap caused by position:relative?

我有一个首页,想放一个横幅,将部分在标题和内容部分,但使用position:relative会产生一个空白区域...

I have a front page and want to put a banner that will be partially above the header and content section, but using position:relative produces an empty area...

查看示例(我要将文字放在红色框下方 ):

http://jsfiddle.net/Ru2CT/

我知道我可以创建另一个相对定位的div作为我的文本的父级,但是我仍然有间隙, footer ...

I know I could create another relative positioned div as a parent of my text, but then I'll still have the gap but between content section & footer...

任何想法? :)

推荐答案

我终于解决了这个问题,简单:

I've finally resolved this issue, simple:

   position: relative;
   bottom: 200px;
   margin-bottom: -200px;

:)

这篇关于如何摆脱差距与位置:相对横幅的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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