How do you preserve a fixed aspect ratio for an embedded element?

Prepare for the CSS Mastery Recipient Portal Test. Study with comprehensive questions and in-depth explanations. Enhance your CSS skills and ace your test!

Multiple Choice

How do you preserve a fixed aspect ratio for an embedded element?

Explanation:
Preserving a fixed aspect ratio means keeping height proportional to width as the element scales. The aspect-ratio property defines that proportion, so when you set aspect-ratio: 16/9 and make the element fill the container width (width: 100%), the browser computes the height automatically to maintain that 16:9 relationship. Height can be left as auto, or explicitly set, and it will follow from the width and the specified ratio. 16/9 is the standard for most embedded videos, so this combination is the most reliable way to keep embeds looking correct across different screen sizes. Using a different ratio would preserve a different proportion, and the last option uses the wrong property name (ratio) and wouldn’t apply.

Preserving a fixed aspect ratio means keeping height proportional to width as the element scales. The aspect-ratio property defines that proportion, so when you set aspect-ratio: 16/9 and make the element fill the container width (width: 100%), the browser computes the height automatically to maintain that 16:9 relationship. Height can be left as auto, or explicitly set, and it will follow from the width and the specified ratio. 16/9 is the standard for most embedded videos, so this combination is the most reliable way to keep embeds looking correct across different screen sizes. Using a different ratio would preserve a different proportion, and the last option uses the wrong property name (ratio) and wouldn’t apply.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy