为什么我的网页顶部有空白? [英] Why is there a gap on the top of my webpage?

查看:57
本文介绍了为什么我的网页顶部有空白?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我敢肯定答案是显而易见的,但是我并没有那么多地使用html/css ...

I'm sure the answer is obvious, but I haven't been working with html/css that much...

浏览器顶部和第一个div之间有空白.我真的不明白为什么存在差距.我没有在CSS中使用margin-top或padding-top或border-top,为什么会有间隙?

There is a gap of white space in between the top of the browser and the first div. I don't really get why the gap is there. I didn't use margin-top or padding-top or border-top in the css, so why is there a gap?

谢谢!

推荐答案

尽管如果您实际发布一些代码或指向该站点的链接将非常有帮助,但我认为这只是默认的填充.大多数浏览器都有可能要清除的默认样式,例如 body .尝试这样的事情:

While it would be extremely helpful if you actually posted some code or a link to the site, I would assume it's just the default padding. Most browsers have default styles for things like body that you may want to clear. Try something like this:

html, body{
   padding: 0;
   margin: 0;
}

如果仍不能解决问题,则需要提供更多信息.

If that doesn't fix it you'll need to give more information.

这篇关于为什么我的网页顶部有空白?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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