How to make a image to fit in all Mobile screens? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to make a image to fit in all Mobile screens?

but the image pixel quality shouldn't reduce

23rd Jul 2017, 4:18 AM
Samundeeswari
Samundeeswari - avatar
4 Answers
+ 5
@Samundeeswari wrote: << but image width is given in px .I have tried in percentage the image wasn't clear >> The image loose aspect ratio only if you specify both width and height in percentage: specify only one will auto calculate the other size keeping aspect ratio... just set width:100% with css (none height) or width="100%" in <img> attribute (but this should be avoided, as deprecated in Html5, and advised to use css) ;)
23rd Jul 2017, 6:47 AM
visph
visph - avatar
0
max-width: in percents is going to help?
23rd Jul 2017, 4:33 AM
Biser Z Ivanov
Biser Z Ivanov - avatar
0
but image width is given in px .I have tried in percentage the image wasn't clear
23rd Jul 2017, 4:35 AM
Samundeeswari
Samundeeswari - avatar
0
Try a higher res one?
23rd Jul 2017, 4:48 AM
Matthew Wong
Matthew Wong - avatar