Viewport Width Units In CSS

Let’s say you have a simple problem: that problem is to make text match a set width or height regardless of the view screen’s size. The answer: using CSS and the viewport sizing. Below are some quick examples of what text looks like when different viewport sizes are applied. One unit in the width 0.5% of the viewport’s width. One unit in the viewport’s height is equivalent to 1% of the available height. If you want the text to be 10% of the view port height? That would be done with font-size: 10vh;

1vw = 1% of viewport width
1vh = 1% of viewport height
1vmin = 1vw or 1vh, whichever is smaller
1vmax = 1vw or 1vh, whichever is larger

When you use this, experiment! Other CSS rules may not entirely cooperate with viewport sizing. Your mileage may vary.


Variable based on height.

 .largeheight {
  font-size: 2vh;
  }

Variable based on minimum.

 .largemin {
  font-size: 2vmin;
  }

Variable based on maximum.

 .largemax {
  font-size: 2vmax;
  }

0123456789

 .largetenheight {
  font-size: 10vh;
  line-height: 10vh; 
  }

Variable based on width.

.largewidth {
  font-size: 2vw;
  }

12345

 .largetenwidth {
  font-size: 20vw;
  line-height: 20vw; 
  }

Want to convert CSS units into variable units?

Our Plugins

MultiSource Plugin Manager

Are you confined by the limitations of the default WordPress plugin repository? Do you wish you could easily integrate plugins from various trusted sources without the hassle of manual installations? MultiSource Plugin Manager is here to revolutionize the way you manage plugins on your WordPress site. Why MultiSource Plugin Manager is a Game-Changer for WordPress […]

Tabular 3

This uses the Datatables.net UI to present posts and their associated fields. Consider this a pre-release.

Fonts For Divi

Our plugin designed to integrate Adobe Fonts with the Divi theme and provide a user-friendly interface for managing font selections directly from the Divi backend offers several key benefits. Divi has Google Fonts built in. Adobe fonts provide a typekit URL and formatting. What if you want the reference available inside of Divi when building […]

Learndash + Breakdance Connector

LearnDash + Breakdance — Compatibility Fix Running LearnDash and Breakdance Builder together on WordPress 6.7 or later? You may have already hit the wall: a white screen, a PHP fatal error in your logs, or course list shortcodes silently breaking inside Breakdance-built pages. This plugin fixes that. What it solves When WordPress 6.7 tightened strict […]

We'll take good care of your website.

Copyright © 2026 - Web321 | All Right Reserved

Outlook Outage

Web321 Clients:

Clients hosting their email with us can access their mail outside of MS Outlook.

Go to https://[your_domain]:2096 

Input your email address and current password. This will take you to webmail. From your webmail, you can see your current mail and send mail to others. 

More information on the outage: CBC