Dimensions

Horizontal and vertical measurement of elements on a webpage. Classes for dimensions follow low-level utility classes to easily set height and width values to any element.

How It Works

  • HPU height and width dimensions cover a broad range of values. For percentages (%) and viewport (vh or vw) units, the range goes from 1 to 100. For pixel (px) and rem units, it spans from 1 to 1000. This wide spectrum allows for creating flexible and precise layouts. These values also support the development of low-level utility classes, giving you fine-grained control over the height and width of elements on a webpage.
  • To apply dimensions on any element, the format will be .hpu-{type}{dimension}{unit}
    • Where the type is either h for height or w for width.
    • Where the dimension is the following range of dimension values:
      • For percentages and viewport units, 1 to 100
      • For pixels and rem units, 1 to 1000
    • Where the unit is one of the following units:
      • pc for percent (%)
      • px for pixels
      • rem for rem units
      • vp for viewport height or width
  • The auto dimension is also available for both height and width values: .hpu-{type}-auto. The unit must not be defined, since the dimension is auto.

Width and Height

Below are the examples of different width and height dimension units.

Width

Width: 15rem

Width: 450px

Width: 30vw

Width: 100%

Width: Auto

Height

Height: Auto

Height: 7rem

Height: 175px

Height: 25vh

Height: 100%

Max Width and Max Height

Max width and height also applies to all the units of dimensions mentioned above: .hpu-max-{w | h}{size}{unit}. The examples below use pc (%) unit.

Max Width

Wrapper Width: 100%

Max Width: 25%

Max Height

Wrapper Height: 20rem

Max Height: 75%

Responsive Dimensions

Responsive variations are also available for both width and height dimensions, auto dimensions, and max width and height:

  • .hpu-{w | h}-auto-{screen}
  • .hpu-{w | h}{dimension}{unit}-{screen}
  • .hpu-max-{w | h}{dimension}{unit}-{screen}
  • Where screen is one of:
    • screen sizes: sm, md, lg, xl, xxl

CURRENT SCREEN SIZE: xs sm md lg xl xxl

Responsive Width

Wrapper Width: 100%

Current Width: 250px

Current Width: 25%

Current Width: 35%

Current Width: 50%

Current Width: 75%

Current Width: 85%

CURRENT SCREEN SIZE: xs sm md lg xl xxl

Responsive Height

Wrapper Height: 350px

Current Height: 50px

Current Height: 25%

Current Height: 35%

Current Height: 50%

Current Height: 75%

Current Height: 85%