如何根据屏幕尺寸调整图像 [英] How to fit an image according to screen size
本文介绍了如何根据屏幕尺寸调整图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
:100%和高度:自动
如果您想覆盖整个父元素,那么高度:100%和宽度:100%
Let's say we have image with 2000px width & 500px height in css property. For a 1080p monitor how can I configure this image properly. I want this image to be set on any screen size for responsive design.
解决方案
if you want to keep aspect ratio then put width:100% and height:auto
if you want to cover whole parent element then height:100% and width:100%
这篇关于如何根据屏幕尺寸调整图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文