easyui.

Discover / Layout

Aspect ratio

Keep media at a consistent proportion.

Usage notes

Set the ratio to match the media you want to display.

Examples use @easyui/react and its stylesheet. Read the setup guide.

Example source

import { AspectRatio } from "@easyui/react";

export default function Example() {
  return (
    <AspectRatio ratio={16 / 9} style={{ background: "#eee9fa", borderRadius: 8, display: "grid", placeItems: "center" }}><span>16 : 9</span></AspectRatio>
  );
}

Explore more components