Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/38.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_Sass - Fatal编程技术网

如何在网格视图CSS中拉伸图像

如何在网格视图CSS中拉伸图像,css,sass,Css,Sass,如何将图像拉伸到网格单元中。更具体地说,我想删除快照照片中显示的左侧和右侧填充。 CSS代码: .container { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; padding: 15px; } .container img { width: 250px; height: 250px; object-fit: fill; displ

如何将图像拉伸到网格单元中。更具体地说,我想删除快照照片中显示的左侧和右侧填充。 CSS代码:

.container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  padding: 15px;
}
.container img {
  width: 250px;
  height: 250px;
  object-fit: fill;
  display: block;
  margin-left: auto;
  margin-right: auto;
  -webkit-filter: grayscale(1);
  filter: grayscale(1);
  transition: all 100ms ease-out;
}
.container img:hover {
  transform: scale(1.04);
  -webkit-filter: grayscale(0);
  filter: grayscale(0);
}

请添加一些html代码。如果可能的话,一段有效的代码片段将有助于回答这个问题。您是否也尝试过更改图像的
宽度
高度
100%
?是的,我尝试了宽度-高度100%,但没有成功。