简体   繁体   English

两者之间的差距 <div> 垂直对齐

[英]Gap between two <div> vertically aligned

I have a display problem with every browser except Firefox. 除Firefox外,其他所有浏览器都存在显示问题。 I actually have this type of code 我实际上有这种类型的代码

 <div id="conteneur"> <div id="milieu"> <div class="textPara"> <div id="conteneur"> <div id="cadre_selection_ecole"> <form id="form_search"> <input type="text" value="" /> <script type="text/javascript"> disableAutocomplete('search'); </script> <div id="listerecherche" style="margin-top:-15px; text-align:left"></div> </form> </div> </div> </div> </div> </div> <div id="footer"> SOME TEXT </div> 

The fact is that there is a gap created between "div id="milieu" " and "div id="footer" ". 事实是,在“ div id =” milieu“ ”和“ div id =” footer“ ”之间存在间隙。 I already tried solutions that involve to add to css some browser webkits, font size and so on. 我已经尝试过涉及将一些浏览器Webkit,字体大小等添加到CSS的解决方案。 When I use the code inspector, it shows me that this gap is nothing but a no-code zone. 当我使用代码检查器时,它向我展示了这个差距不过是一个无代码区域。

You will find here the gap between the two divs . 您将在此处找到两个div之间的差距

Any suggestion ? 有什么建议吗?

Your problem is that <form> has a height stablished by default (at least in Chrome, which is 39px). 您的问题是<form>具有默认设置的高度(至少在Chrome中为39px)。 Eliminating this property should do the work (maybe you have to do extra work, as setting a <p>SOME TEXT</p> instead of pure text). 消除此属性应该可以完成工作(也许您需要做更多的工作,例如设置<p>SOME TEXT</p>而不是纯文本)。

As suggested by RompePC (thanks), i tried the top rated solution here . 正如RompePC的建议(谢谢),我在这里尝试了评分最高的解决方案。 I adapted it to my problem like that 我像那样适应了我的问题

 @media screen and (-webkit-min-device-pixel-ratio:0) { /* webkit specific CSS */ div#milieu { height:0px; } div#footer { height:0px; } } 

My problem is now solved. 我的问题现在解决了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM