gpt4 book ai didi

html - 具有固定高度和 100% 宽度的图像

转载 作者:行者123 更新时间:2023-11-28 06:13:57 28 4
gpt4 key购买 nike

我真的无法让这张图片以固定高度水平拉伸(stretch) 100%。我不关心失真,因为它只是一个 svg 模式。我已经尝试过使用 img-tag 和 div,以 svg 作为背景,但似乎没有任何效果。我现在得到的是:

.divider{
width: 100%;
height: 50px;
position: absolute;
left: 0;
bottom: 0;
background: url(../images/wave.svg);
background-repeat:no-repeat;
background-size: auto 50px;
}
<div class="divider"></div>

编辑:

澄清截图

enter image description here

最佳答案

使用

height:100vh; 

它用于视口(viewport)高度。

还有 vw for vieport witdth。

但要特别注意 ios 无法处理它.. 所以对于 ios 设备设置一个固定的高度。

some further informations about vh

can i use vw, vh?

问候提莫修斯

关于html - 具有固定高度和 100% 宽度的图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35991227/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com