Skip to content

aspect-ratio

Utilities for controlling the aspect ratio of a widget box during Iced layout.

ISS preview
Iced + ISS preview demonstrating aspect-ratio
ISS preview for aspect-ratio
use iced::widget::container;
use iss::{tw, TwExt};
let preview = container(content)
.tw(tw!("w-full aspect-video rounded-xl overflow-hidden bg-zinc-900"));
Tailwind Class CSS Property / Effect iss::typed Builder
aspect-square aspect-ratio: 1 / 1; .aspect_square()
aspect-video aspect-ratio: 16 / 9; .aspect_video()
aspect-auto aspect-ratio: auto; .aspect_auto()
aspect-<w>/<h> aspect-ratio: <w> / <h>; .aspect_ratio(4, 3)
aspect-[3/2] aspect-ratio: 3 / 2; .aspect_ratio(3, 2)

width · height · object-fit