Can we give height related to width ? | Sololearn: Learn to code for FREE!
+ 8

Can we give height related to width ?

Eg. width:80%; height:same as width; or 70% of width; Since screen sizes differ from phone to phone but can the ratio be the same JavaScript or any CSS method ?

14th Apr 2017, 4:22 AM
UtkőĪrsh
UtkőĪrsh - avatar
2 Réponses
+ 15
This can help :- In Jquery var cw = $('div').width(); $('div').css({'height':cw+'px'});
14th Apr 2017, 4:29 AM
Nikhil
Nikhil - avatar
+ 1
maybe using vh values for the width? g2g is view heigh.
14th Apr 2017, 3:43 PM
◊Ė◊ē◊Ē◊® ◊¶'◊ô◊§◊®◊ē◊ė
◊Ė◊ē◊Ē◊® ◊¶'◊ô◊§◊®◊ē◊ė - avatar