Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
CSS中背景图像的边距_Css - Fatal编程技术网

CSS中背景图像的边距

CSS中背景图像的边距,css,Css,我在一个div上有一个背景图像,div的大小设置为图像的大小,但是,我无法删除显示在左侧的边距。见下面的CSS .faders-image { background-image: url(../images/background.jpg); background-repeat: no-repeat; position: fixed; width: 512px; height: 512px; right: 0rem; bottom: 0rem; margin:

我在一个div上有一个背景图像,div的大小设置为图像的大小,但是,我无法删除显示在左侧的边距。见下面的CSS

.faders-image {
  background-image: url(../images/background.jpg);
  background-repeat: no-repeat;
  position: fixed; 
  width: 512px;
  height: 512px;
  right: 0rem; 
  bottom: 0rem;
  margin: 0; 
  border: none;
  padding 0;
  -webkit-opacity: 0.50;
  z-index: 8; 
}

如果页面左边距有问题,可以使用以下样式

.faders-image {
  background-image: url(heart-icon.png);
  background-repeat: no-repeat;
  position: fixed; 
  width: 512px;
  height: 512px;
  left: 0; 
  bottom: 0rem;
  margin: 0; 
  border: none; padding 0;
  -webkit-opacity: 0.50;
  z-index: 8;
}

我已将样式
right:0rem
更改为
left:0

请提供实时预览,例如。g。在JSFiddle.net上,如果添加
背景位置:左上角?是否设置了
*{margin:0;padding:0;}
?这将删除DOM元素的所有边距和填充,除非另有指定而不是
填充:0也许这就是你的问题-webkit前缀在不透明度上已经不需要200年了。也许更多。