如何摆脱 CSS/HTML 部分之间的空白

Abh*_*aha 4 html css

我是网页设计的新手,遇到了这个问题;我有两个部分,每个部分都有它赢得的背景图像。但是,第一个背景图像不会在上一个背景图像之后立即结束。相反,两个图像之间有一个看起来很可怕的空白。

这是 jsfiddle:http : //jsfiddle.net/M26Ge/

CSS:

#slide-1 .bcg {
  background-image:url('http://upload.wikimedia.org/wikipedia/commons/1/15/Hopwas_Woods_Sun.jpg');  
  background-position: center center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  background-size: cover;
  height: 800px;
  width: 100%;
}
#slide-2 .bcg{
  background-image:url('http://i953.photobucket.com/albums/ae11/Kronstadt/Shabby-Princess-Kristie_SF_StripedP.jpg');
  background-position: center center;
  background-repeat: repeat;
  background-attachment: fixed;
  background-size: cover;
  height: 100%;
  width: 100%;
}
Run Code Online (Sandbox Code Playgroud)

kos*_*mos 6

我不确定,但也许你在找CSS Reset

只需写* { margin: 0; padding: 0; }在 css 代码的顶部。否则,如果您有内联元素的其他空白问题,您可以使用font-size: 0;受影响元素的容器来修复它们。