πŸ“
πŸ“±

CSS Units for Responsive Design

Convert between px, vw, vh, and % to build layouts that respond correctly to different screen sizes and orientations.

Nid oes angen mewngofnodi
1rem

Context (affects rem/em/vw/vh/%)

All conversions for 16 px
Root EM (rem)1 rem
EM (em)1 em
Points (pt)12 pt
Viewport Width (vw)1.11111 vw
Viewport Height (vh)1.77778 vh
Percent (%)100 %

Common pixel sizes β†’ rem (at 16px base)

Responsive tips

πŸ“±

Viewport units (vw, vh) are great for hero sections and overlays but can cause issues on mobile where browser UI shifts. Use dvh when targeting modern browsers.

πŸ’‘

For fluid typography, clamp() uses vw units: font-size: clamp(1rem, 2vw + 0.5rem, 2rem). Use the vw converter to calculate the middle value for your design.

πŸ“

Percentage units are relative to the parent container, not the viewport. Enter the parent's pixel size in the context panel to get accurate % conversions.

πŸ”

The viewport dimensions in the context panel affect vw and vh conversions. Set them to your target breakpoints (e.g., 375px mobile, 1440px desktop) for accurate results.

Sut Mae'n Gweithio

1
Ewch i mewn
Enter your data into the tool above. Everything stays local to your browser.
2
Proses
The tool processes your data instantly in your browser using JavaScript. No server, no waiting.
3
Lawrlwythwch
Get your result instantly. Nothing is stored after you leave the page β€” complete privacy.

Pam defnyddio ein un ni?

βœ“Hollol rhad ac am ddim - dim costau cudd, byth
βœ“Nid oes angen cyfrif, e-bost na mewngofnodi
βœ“Nid yw ffeiliau byth yn gadael eich dyfais
βœ“Dim cyfyngiadau maint ffeil o gwbl
βœ“Dim dyfrnodau ar unrhyw allbwn

Also check out…

Cwestiynau Cyffredin