Total sum of vh/vw higher than 100 - is it OK?

Hello campers!

This is a theoretical question.

I’m interested in viewport units - as we know, vh and vw are hundredths of the viewport height and weight. The question is - could the total sum of all vh or vw values, on a specific page, be more than 100? Is it semantically acceptable?

I know it works, but logically, if 1 vw/1vh is equivalent to 1%, then the total sum of them should be max. 100%. Am I right?

Kind regards,

Hi @geekboy

vh and vw are like any other relative unit, ie. percentages.

If you set height or width of an element to value above browser dimensions, the browser won’t be able to show it all at once. That’s it.

1 Like

So even if I set i.e. vh to 150, then it won’t be a bug, just the browser won’t be able to show all the page at once. Right?

That’s right. Most web pages have height much above browser window height. In such cases a scrollbar shows up and saves the day. Completely normal situation.

1 Like