html css margin(网页边缘的空白) [英] html css margin(white spaces at webpage edges)

查看:70
本文介绍了html css margin(网页边缘的空白)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基本上,我的网站边缘出现问题,出现空白:

Basically I got problem with the edge of my website, it got this white spaces :

http://sadpanda.us/images/1885204-15X1WA4.jpg

虽然我希望该网站看起来像这样:

While I want that web to look like this :

http://sadpanda.us/images/1885205-VG8KJ23.jpg

没有空格.

知道我做错了什么吗?

推荐答案

这与< body> 上的默认 margin 非常相似.

That looks very much like the default margin on the <body>.

body {
  margin: 0;
}

应该为您解决.

CSS:

html, body {
    height: 100%;
}
div {
    width: 100%;
    height: 100%;
    background: #ddd;
}

带空格的演示

CSS:

html, body {
    height: 100%;
}
body {
    margin: 0; /* This will stop the margin, setting it to 0 */
}
div {
    width: 100%;
    height: 100%;
    background: #ddd;
}

无空间演示

这篇关于html css margin(网页边缘的空白)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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