How to maximize an element's height based on a device's height in html5 or css3? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to maximize an element's height based on a device's height in html5 or css3?

25th Sep 2018, 3:36 AM
Alex Schneider
Alex Schneider - avatar
8 Answers
+ 1
position: fixed; top: 0; height: 100vh
25th Sep 2018, 5:15 AM
Calviղ
Calviղ - avatar
+ 2
Calviղ how to do this without fix position?
25th Sep 2018, 6:56 AM
BALOOCH ANZARAHMEDKHAN ZAKIRAHMEDKHAN
BALOOCH ANZARAHMEDKHAN ZAKIRAHMEDKHAN - avatar
+ 1
"position: fixed;" will make the element's position relative to the viewport However, I'm not sure that's what Alex is trying to ask. I think it's more complicated than that. Try: https://css-tricks.com/css-media-queries/ But typically we would make the element width match the viewport width and let the content flow vertically. Maybe Alex's use case is different.
25th Sep 2018, 4:43 AM
Janning⭐
Janning⭐ - avatar
+ 1
Calvin thank you so much it worked!
25th Sep 2018, 5:21 AM
Alex Schneider
Alex Schneider - avatar
+ 1
Calviղ okay
25th Sep 2018, 7:48 AM
BALOOCH ANZARAHMEDKHAN ZAKIRAHMEDKHAN
BALOOCH ANZARAHMEDKHAN ZAKIRAHMEDKHAN - avatar
0
you can mack your height 100% height:100%;
25th Sep 2018, 3:43 AM
estifanos
estifanos - avatar
0
it doesn't work.
25th Sep 2018, 4:03 AM
Alex Schneider
Alex Schneider - avatar
0
BALOOCH ANZARAHMEDKHAN ZAKIRAHMEDKHAN you could use position:absolute to refer the its parent point.
25th Sep 2018, 7:46 AM
Calviղ
Calviղ - avatar