Skip to content

Width

Below, utility classes to apply width property.

@for $value from 0 through 64

ClassProperties
.w-autowidth: auto;
.w-viewwidth: 100vw;
.w-<value>width: #{$value * 0.25}rem;
.w-96width: 24rem; /* 384px */
.w-128width: 32rem; /* 512px */
.w-1/1width: 100%;
.w-1/2width: 50%;
.w-1/3width: 33.333%;
.w-2/3width: 66.667%;
.w-1/4width: 25%;
.w-2/4width: 50%;
.w-3/4width: 75%;
.w-1/5width: 20%;
.w-2/5width: 40%;
.w-3/5width: 60%;
.w-4/5width: 80%;
.w-1/6width: 16.667%;
.w-2/6width: 33.333%;
.w-3/6width: 50%;
.w-4/6width: 66.667%;
.w-5/6width: 83.333%;

Example(s)

html
<div class="w-64 h-12 ..."></div>
<div class="w-56 h-12 ..."></div>
<div class="w-48 h-12 ..."></div>
<div class="w-32 h-12 ..."></div>
<div class="w-24 h-12 ..."></div>
<div class="w-16 h-12 ..."></div>
<div class="w-8 h-12 ..."></div>
html
<div class="flex-column w-64">
  <div class="w-1/4 h-12 ..."></div>
  <div class="w-2/4 h-12 ..."></div>
  <div class="w-3/4 h-12 ..."></div>
  <div class="w-1/1 h-12 ..."></div>
</div>

Min Width

Below, utility classes to apply min-width property.

@for $value from 0 through 64

ClassProperties
.min-w-<value>min-width: #{$value * 0.25}rem;

Max Width

Below, utility classes to apply max-width property.

@for $value from 0 through 64

ClassProperties
.max-w-<value>max-width: #{$value * 0.25}rem;

Media Queries

width is supported by changing state on-the-fly! You can use it like this:

html
<div class="w-1/1 small:w-3/4 medium:w-1/2 large:w-1/4">...</div>

Released under the Beerware 🍺 License.