本文介绍了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(网页边缘的空白)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 04:28