CSS UtilitiesFrame

Frame

A frame is a box that keeps a fixed shape no matter how big or small it gets. Wrap an image, video, map, or placeholder in cs-frame and it stays a square by default, or a landscape, portrait, or any custom aspect ratio you specify, even as the surrounding layout resizes. That means no more letterboxing, no more collapsed boxes waiting on a slow image to load, and no more cards that end up different heights.

Pair cs-frame with one of the cs-border-radius-* classes to round the corners without cropping the content inside.

Examples

Frames are well-suited for images and image placeholders.

The Lord of the Rings: The Fellowship of the Ring

J.R.R. Tolkien
Options
Grey and white tabby kitten

White-socks

Kitten • Male
Adopt this pet Favorite
Photo coming soon

Bumpkin

Adult • Male
Adopt this pet Favorite
Diluted calico kitten

Swish-tail

Kitten • Female
Adopt this pet Favorite
Short-haired tabby cat

Sharp-ears

Adult • Female
Adopt this pet Favorite

Aspect Ratio

Frames have a square aspect ratio by default. You can append :square (1 / 1), :landscape (16 / 9), or :portrait (9 / 16) to the cs-frame class in your markup to specify an aspect ratio for the frame. Alternatively, you can define the aspect-ratio property to set a custom proportion.

Border Radius

Frames have a square border radius by default. Add any cs-border-radius-* class to round the corners, or define the border-radius property to set custom rounding.