Tsallaka zuwa abun ciki
Justice Tech School

Viewport Units and Fluid Layout

vw and vh are percentages of the viewport. dvh handles mobile browser bars. Use them for hero heights and fluid type, with sensible limits.

Example
<style>
.h { height: 20vh; background: linear-gradient(#0f766e, #1e293b); display: grid; place-items: center }
</style>
<div class="h">20vh hero</div>

Exercise

Viewport height unit.

height: 50;

Quiz Test

What is 1vw?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.