⊗mkSpUnVV 84 of 128 menu

The vw and vh units in CSS

The units vw and vh allow you to set the size relative to the browser window viewport. Let's look at an example.

Let's say we have some div:

<div></div>

Let's give it a width of half the viewport width and a height of half the viewport height:

div { width: 50vw; height: 50vh; margin: 30px auto; border: 1px solid red; }

Let's see what we get:

Given a div, give it a top padding equal to 30% of the viewport height.

Given a div, give it a width and height equal to 70% the viewport width.

English
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline