Chrome / Safari / Webkit上的额外填充 - 任何想法? [英] Extra padding on Chrome/Safari/Webkit -- any ideas?

查看:168
本文介绍了Chrome / Safari / Webkit上的额外填充 - 任何想法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的网页在网页顶部有这个额外的内容,无法移除。

My page has this extra padding on the top of page that I'm unable to remove. Tried everything under the sun and hope someone can show me the way.

任何想法?

推荐答案

您的网页在顶部附近有一个元素,顶部边距延伸到页面封装之外。如果您有这个:

Your page has an element near the top with a top-margin that extends outside your page wrapper. If you have this:

<div class="wrapper" style="margin: 0">
  <div class="section" style="margin: 40px 0"> Stuff! </div>
</div>

然后 .section .wrapper 的顶部,其40px边距将延伸到顶部。这与边距折叠在一起的方式有关,因此元素之间的两个边距不会累积。您可以通过在包装器中添加 overflow:hidden 来防止这种情况。

Then the .section element will be positioned at the top of the .wrapper and its 40px margin will extend out the top. This has to do with the way margins collapse together so that two margins between elements don't accumulate. You can prevent this by adding overflow: hidden on the wrapper.

在您的标记中, $ c> .mini-search 元素具有40px顶部边距。请删除此边距,或在包含该边距的字段集中添加 overflow:hidden

In your markup, it's the .mini-search element that has a 40px top margin. Either remove this margin, or add overflow: hidden on the fieldset that contains it.

这篇关于Chrome / Safari / Webkit上的额外填充 - 任何想法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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