Class Reference

Size

Class Reference

Size

Element sizes, widths, heights and viewport sizing.

How to use

Use width-full for a container that fills its parent. Set minimum or maximum dimensions when content should be allowed to grow. Viewport height classes are useful for full-height sections.

Responsive behavior

Percentage sizes depend on the parent. vh, svh and dvh describe different viewport heights; check the unit shown below before choosing a screen-height class.

Visual reference

Blue elements show the installed sizing classes. Dashed outlines mark the parent boundaries. Large examples can be scrolled so you can compare their width and height.

.size-5xswidth: var(--size-5xs) · height: var(--size-5xs)

The square uses the installed size variable without scaling. Very small tokens appear as a dot.

.size-4xswidth: var(--size-4xs) · height: var(--size-4xs)

The square uses the installed size variable without scaling. Very small tokens appear as a dot.

.size-3xswidth: var(--size-3xs) · height: var(--size-3xs)

The square uses the installed size variable without scaling. Very small tokens appear as a dot.

.size-2xswidth: var(--size-2xs) · height: var(--size-2xs)

The square uses the installed size variable without scaling. Very small tokens appear as a dot.

.size-xswidth: var(--size-xs) · height: var(--size-xs)

The square uses the installed size variable without scaling. Very small tokens appear as a dot.

.size-smwidth: var(--size-sm) · height: var(--size-sm)

The square uses the installed size variable without scaling. Very small tokens appear as a dot.

.size-mdwidth: var(--size-md) · height: var(--size-md)

The square uses the installed size variable without scaling. Very small tokens appear as a dot.

.size-lgwidth: var(--size-lg) · height: var(--size-lg)

The square uses the installed size variable without scaling. Very small tokens appear as a dot.

.size-xlwidth: var(--size-xl) · height: var(--size-xl)

The square uses the installed size variable without scaling. Very small tokens appear as a dot.

.size-2xlwidth: var(--size-2xl) · height: var(--size-2xl)

The square uses the installed size variable without scaling. Very small tokens appear as a dot.

.size-3xlwidth: var(--size-3xl) · height: var(--size-3xl)

The square uses the installed size variable without scaling. Very small tokens appear as a dot.

.size-4xlwidth: var(--size-4xl) · height: var(--size-4xl)

The square uses the installed size variable without scaling. Very small tokens appear as a dot.

.size-5xlwidth: var(--size-5xl) · height: var(--size-5xl)

The square uses the installed size variable without scaling. Very small tokens appear as a dot.

.size-displaywidth: var(--size-display) · height: var(--size-display)

The square uses the installed size variable without scaling. Very small tokens appear as a dot.

.size-dividerwidth: var(--size-divider) · height: var(--size-divider)

The square uses the installed size variable without scaling. Very small tokens appear as a dot.

.width-autowidth: auto

The dashed frame is the parent width. The installed class controls the blue element’s width.

.width-fitwidth: fit-content

The dashed frame is the parent width. The installed class controls the blue element’s width.

.width-fullwidth: 100%

The dashed frame is the parent width. The installed class controls the blue element’s width.

.width-screenwidth: 100vw

The dashed frame is the parent width. The installed class controls the blue element’s width.

.width-halfwidth: 50%

The dashed frame is the parent width. The installed class controls the blue element’s width.

.width-thirdwidth: 33.3333%

The dashed frame is the parent width. The installed class controls the blue element’s width.

.width-two-thirdswidth: 66.6667%

The dashed frame is the parent width. The installed class controls the blue element’s width.

.width-quarterwidth: 25%

The dashed frame is the parent width. The installed class controls the blue element’s width.

.width-three-quarterswidth: 75%

The dashed frame is the parent width. The installed class controls the blue element’s width.

.height-autoheight: auto

The dashed parent is 200px tall. Percentage heights resolve against that parent; viewport units use your browser height.

.height-fitheight: fit-content

The dashed parent is 200px tall. Percentage heights resolve against that parent; viewport units use your browser height.

.height-fullheight: 100%

The dashed parent is 200px tall. Percentage heights resolve against that parent; viewport units use your browser height.

.height-screenheight: 100vh

The dashed parent is 200px tall. Percentage heights resolve against that parent; viewport units use your browser height.

.height-screen-dynamicheight: 100dvh

The dashed parent is 200px tall. Percentage heights resolve against that parent; viewport units use your browser height.

.height-screen-smallheight: 100svh

The dashed parent is 200px tall. Percentage heights resolve against that parent; viewport units use your browser height.

.height-halfheight: 50%

The dashed parent is 200px tall. Percentage heights resolve against that parent; viewport units use your browser height.

.min-width-0min-width: 0

The target flex item may shrink below its content width; the sibling keeps 35% of the parent.

.min-width-fullmin-width: 100%

The dashed frame is the parent width. The installed class controls the blue element’s width.

.min-width-screenmin-width: 100vw

The dashed frame is the parent width. The installed class controls the blue element’s width.

.min-height-0min-height: 0

The target may shrink below its content height to leave room for the fixed-height sibling. The parent clips excess content.

.min-height-fullmin-height: 100%

The dashed parent is 200px tall. Percentage heights resolve against that parent; viewport units use your browser height.

.min-height-screenmin-height: 100vh

The dashed parent is 200px tall. Percentage heights resolve against that parent; viewport units use your browser height.

.min-height-screen-dynamicmin-height: 100dvh

The dashed parent is 200px tall. Percentage heights resolve against that parent; viewport units use your browser height.

.min-height-screen-smallmin-height: 100svh

The dashed parent is 200px tall. Percentage heights resolve against that parent; viewport units use your browser height.

.min-height-half-screenmin-height: 50vh

The dashed parent is 200px tall. Percentage heights resolve against that parent; viewport units use your browser height.

.max-width-nonemax-width: none

The dashed frame is the parent width. The sample starts at 150% width; this class sets its maximum.

.max-width-fullmax-width: 100%

The dashed frame is the parent width. The sample starts at 150% width; this class sets its maximum.

.max-width-screenmax-width: 100vw

The dashed frame is the parent width. The sample starts at 150% width; this class sets its maximum.

.max-width-1920max-width: var(--layout-width-1920)

The dashed frame is the parent width. The installed class controls the blue element’s width.

.max-width-1600max-width: var(--layout-width-1600)

The dashed frame is the parent width. The installed class controls the blue element’s width.

.max-width-1440max-width: var(--layout-width-1440)

The dashed frame is the parent width. The installed class controls the blue element’s width.

.max-width-1280max-width: var(--layout-width-1280)

The dashed frame is the parent width. The installed class controls the blue element’s width.

.max-width-960max-width: var(--layout-width-960)

The dashed frame is the parent width. The installed class controls the blue element’s width.

.max-width-768max-width: var(--layout-width-768)

The dashed frame is the parent width. The installed class controls the blue element’s width.

.max-height-nonemax-height: none

The dashed parent is 200px tall. The sample starts at 320px height; this class sets its maximum.

.max-height-fullmax-height: 100%

The dashed parent is 200px tall. The sample starts at 320px height; this class sets its maximum.

.max-height-screenmax-height: 100vh

The dashed parent is 200px tall. The sample starts 80px taller than the browser viewport; this class sets its maximum.

.max-height-screen-dynamicmax-height: 100dvh

The dashed parent is 200px tall. The sample starts 80px taller than the browser viewport; this class sets its maximum.

.max-height-screen-smallmax-height: 100svh

The dashed parent is 200px tall. The sample starts 80px taller than the browser viewport; this class sets its maximum.

Overflow side by sideThe same twelve lines in the same frame
visible
  1. Line 1
  2. Line 2
  3. Line 3
  4. Line 4
  5. Line 5
  6. Line 6
  7. Line 7
  8. Line 8
  9. Line 9
  10. Line 10
  11. Line 11
  12. Line 12
hidden
  1. Line 1
  2. Line 2
  3. Line 3
  4. Line 4
  5. Line 5
  6. Line 6
  7. Line 7
  8. Line 8
  9. Line 9
  10. Line 10
  11. Line 11
  12. Line 12
auto
  1. Line 1
  2. Line 2
  3. Line 3
  4. Line 4
  5. Line 5
  6. Line 6
  7. Line 7
  8. Line 8
  9. Line 9
  10. Line 10
  11. Line 11
  12. Line 12
scroll
  1. Line 1
  2. Line 2
  3. Line 3
  4. Line 4
  5. Line 5
  6. Line 6
  7. Line 7
  8. Line 8
  9. Line 9
  10. Line 10
  11. Line 11
  12. Line 12

Visible lets content spill out, hidden cuts it off, auto and scroll let you scroll to it. The frame is the element with the class.

.overflow-visibleoverflow: visible
  1. Line 1
  2. Line 2
  3. Line 3
  4. Line 4
  5. Line 5
  6. Line 6
  7. Line 7
  8. Line 8
  9. Line 9
  10. Line 10
  11. Line 11
  12. Line 12

Nothing is cut off: the lines carry on past the frame (shown lighter outside it).

.overflow-hiddenoverflow: hidden
  1. Line 1
  2. Line 2
  3. Line 3
  4. Line 4
  5. Line 5
  6. Line 6
  7. Line 7
  8. Line 8
  9. Line 9
  10. Line 10
  11. Line 11
  12. Line 12

The frame cuts the content off at its edge; the faint part outside is what you lose. It can still be scrolled by a script, not by the visitor.

.overflow-clipoverflow: clip
  1. Line 1
  2. Line 2
  3. Line 3
  4. Line 4
  5. Line 5
  6. Line 6
  7. Line 7
  8. Line 8
  9. Line 9
  10. Line 10
  11. Line 11
  12. Line 12

Cuts the content off like hidden, and it cannot be scrolled at all, not even by a script.

.overflow-autooverflow: auto
  1. Line 1
  2. Line 2
  3. Line 3
  4. Line 4
  5. Line 5
  6. Line 6
  7. Line 7
  8. Line 8
  9. Line 9
  10. Line 10
  11. Line 11
  12. Line 12

Scrollbars appear only where the content is bigger than the frame. Scroll inside the frame.

.overflow-scrolloverflow: scroll
  1. Line 1
  2. Line 2
  3. Line 3
  4. Line 4
  5. Line 5
  6. Line 6
  7. Line 7
  8. Line 8
  9. Line 9
  10. Line 10
  11. Line 11
  12. Line 12

Always shows scrollbars, even when the content would fit. Scroll inside the frame.

.overflow-x-hiddenoverflow-x: hidden
Item 1Item 2Item 3Item 4Item 5Item 6Item 7Item 8Item 9Item 10Item 11Item 12

A row that is too wide is cut off at the right edge.

.overflow-x-autooverflow-x: auto
Item 1Item 2Item 3Item 4Item 5Item 6Item 7Item 8Item 9Item 10Item 11Item 12

A row that is too wide scrolls sideways.

.overflow-y-hiddenoverflow-y: hidden
  1. Line 1
  2. Line 2
  3. Line 3
  4. Line 4
  5. Line 5
  6. Line 6
  7. Line 7
  8. Line 8
  9. Line 9
  10. Line 10
  11. Line 11
  12. Line 12

A list that is too tall is cut off at the bottom edge.

.overflow-y-autooverflow-y: auto
  1. Line 1
  2. Line 2
  3. Line 3
  4. Line 4
  5. Line 5
  6. Line 6
  7. Line 7
  8. Line 8
  9. Line 9
  10. Line 10
  11. Line 11
  12. Line 12

A list that is too tall scrolls up and down.

.aspect-autoaspect-ratio: auto

A consistent starting width makes the ratios comparable. Auto uses the sample’s 120px content height.

.aspect-squareaspect-ratio: 1 / 1

A consistent starting width makes the ratios comparable. Auto uses the sample’s 120px content height.

.aspect-videoaspect-ratio: 16 / 9

A consistent starting width makes the ratios comparable. Auto uses the sample’s 120px content height.

.aspect-landscapeaspect-ratio: 4 / 3

A consistent starting width makes the ratios comparable. Auto uses the sample’s 120px content height.

.aspect-portraitaspect-ratio: 3 / 4

A consistent starting width makes the ratios comparable. Auto uses the sample’s 120px content height.

.aspect-photoaspect-ratio: 3 / 2

A consistent starting width makes the ratios comparable. Auto uses the sample’s 120px content height.

.aspect-photo-portraitaspect-ratio: 2 / 3

A consistent starting width makes the ratios comparable. Auto uses the sample’s 120px content height.

.aspect-wideaspect-ratio: 21 / 9

A consistent starting width makes the ratios comparable. Auto uses the sample’s 120px content height.

.object-coverobject-fit: cover

The same 4:3 image sits in a wide, 200px-high frame. Compare cropping, empty space, and stretching.

.object-containobject-fit: contain

The same 4:3 image sits in a wide, 200px-high frame. Compare cropping, empty space, and stretching.

.object-fillobject-fit: fill

The same 4:3 image sits in a wide, 200px-high frame. Compare cropping, empty space, and stretching.

.object-noneobject-fit: none

The same 4:3 image sits in a wide, 200px-high frame. Compare cropping, empty space, and stretching.

.object-scale-downobject-fit: scale-down

The same 4:3 image sits in a wide, 200px-high frame. Compare cropping, empty space, and stretching.

.aspect-4x5aspect-ratio: 4 / 5

A consistent starting width makes the ratios comparable. Auto uses the sample’s 120px content height.

.max-width-320max-width: var(--layout-width-320)

The dashed frame is the parent width. The installed class controls the blue element’s width.

.max-width-480max-width: var(--layout-width-480)

The dashed frame is the parent width. The installed class controls the blue element’s width.

.max-width-640max-width: var(--layout-width-640)

The dashed frame is the parent width. The installed class controls the blue element’s width.