gpt4 book ai didi

html - 图像大小根据应用程序中的 div 大小

转载 作者:太空宇宙 更新时间:2023-11-03 21:17:00 24 4
gpt4 key购买 nike

我正在 phonegap 上开发移动应用。

我有一个场景,人们将附加图像和上传图像。

因此,无论 div 大小是多少,我都希望我的图像具有那么大的大小,而不管它的原始大小。

下面是代码块

  <div class="comment-div">
<h2>User 2 <span>15 Aug 2016</span></h2>
<p>When we will be able to build a society of humans on Mars? </p>
</div>

<div class="comment-div odd">
<h2>User 1 <span>15 Aug 2016</span></h2>
<p>I think if you managed to keep your hand still in the bucket, you would suffer from significant muscle atrophy. </p>
</div>

<div class="comment-div">
<img src="http://webcareinfoway.com/images/Web_pics/android-logo-transparent.png" alt="Smiley face">
</div>

<div class="comment-div">
<img src="http://vectorlogo4u.com/wp-content/uploads/2015/09/Google-New-2015-logo-720x340.png" alt="Smiley face">
</div>

这是 fiddle对于相同的。请帮忙

最佳答案

添加宽度100%

.comment-div img{
width:100%;
}

关于html - 图像大小根据应用程序中的 div 大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41340887/

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