howard
howard

Reputation: 254

How can I determine the actual viewport / window height in mobile browsers?

On my computer / PC it is easy, I simply do:

div{
  height: 100vh;
}

to create a div that is the height of the window.

However on mobile browsers the height will actually be more than the view port or window.

This causes the div to be scrollable which I do not want.

I see this on both Chrome mobile and Safari mobile

Upvotes: 1

Views: 1889

Answers (1)

Adrian Kokot
Adrian Kokot

Reputation: 3246

There's no a css solution. Why, you can read here. If you want to get 100% of actual viewport on load, you can use javascript to read the height on page load, by calling window.innerHeight.

Upvotes: 1

Related Questions