` or skewing the image.
I can't predict the aspect-ratio of the image, so there's no way to know whether to use:

or

I can't use both (i.e. style="width: 100%; height: 100%;") because that will stretch the image to fit the ``.
The `

` has a size set by percentage of the screen, which is also unpredictable.
If you need the image to fill either height or width to the corresponding dimensions of the div, I can only think of using javascript. Is that something you are keen to explore?
If you need the image to fill either height or width to the corresponding dimensions of the div, I can only think of using javascript. Is that something you are keen to explore?
以上就是How do you stretch an image to fill a
while keeping the image's aspect-ratio?的详细内容,更多请关注web前端其它相关文章!
相关文章
评论 抢沙发
前端开发相关广告投放 更专业 更精准
联系我们觉得文章有用就打赏一下文章作者
支付宝扫一扫打赏

微信扫一扫打赏
