2017-05-25 116 views
0

嗨我有一个页面问题http://nroux.com 我使用Wordpress中的DIVI主题构建它。覆盖整个div的图像CSS

我希望图片覆盖文本旁边的整个div,而不管图片的大小。 图片不应该变形,因此它是一种: 最小宽度:100%和最小高度:100%与其余自动我猜,但我尝试了几个选项,我发现在stackoverflow但没有成功。 enter image description here

有人可以帮我吗?

感谢

+0

尝试background-size:100%100%;或background-size:包含; – Gerard

回答

1
.et_pb_image{ 
    height: 100%; 
    width: 100%; 
} 
.et_pb_image img{ 
    object-fit: cover; 
    width: 100%; 
    height: 100%; 
} 

试试这个CSS系统。 et_pb_image是图像属于

类名
+0

非常感谢! – yoan26

1

尝试这样的事情

<img src="image.jpg" style="width: 100%; height: 100%; object-fit: cover;">

0

您可以尝试应用此CSS的图像容器:

.container { 
    position: relative; 
    height: 100%; 
    width: 100%; 
    overflow: hidden; 
} 

这到图像:

.container img { 
    position: absolute; 
    top: 0; 
    left: 0; 
    height: 100%; 
    width: auto; 
    max-width: initial; 
} 

图像可能或多或少隐藏,这取决于图像和文本大小思想。