Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Setting a Div height to the window viewport size Reply To: Setting a Div height to the window viewport size

#202650
collyg
Participant

why not just use CSS alone:

div
{
width = 100vh;
height = 100vw;
}
Where 100 is the full size (100% of the screen dimension – X(vw) or Y (vh) axis). and 10 would be 10% of same.

These are an uncomplicated and constant means to set elemetns at a specific percentage of the screen width and the screen height respectively, and this also responds to screen re-size elegantly!!

CollyG