If i have some object in css with height: 45%; how to create same width? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

If i have some object in css with height: 45%; how to create same width?

If i have some object in css with height: 45%; how to create same width? Sorry for my English.

9th Aug 2019, 6:00 PM
Tonik Horkel ಠ_ಠ
Tonik Horkel ಠ_ಠ - avatar
2 Answers
+ 2
If your 45% is the window height's 45%, you can just use '45vh'. It will be the 45% of the screen height, even when used on width
9th Aug 2019, 6:02 PM
Airree
Airree - avatar
+ 4
You can use something called "vmin" , or "vmax" (1 of them for both width and height) vmin is the smaller size of the screen. If your screen height is smaller than its width, then vmin ==vh , or if your screen width is smaller than your screen height, then vmin == vw. The same (but inverted) applies to vmax. I hope you understand. 😊
9th Aug 2019, 8:39 PM
🍇 Alex Tușinean 💜
🍇 Alex Tușinean 💜 - avatar