Complete the code to set a fixed aspect ratio of 16:9 on the box.
div {
aspect-ratio: [1];
background-color: lightblue;
width: 300px;
}The aspect-ratio property accepts a ratio like 16/9 to keep the width and height proportional.
Complete the code to keep the aspect ratio of the image container at 4:3.
.image-container {
aspect-ratio: [1];
width: 400px;
background-color: #ddd;
}Setting aspect-ratio: 4/3; keeps the container width to height ratio as 4 to 3.
Fix the error in the CSS to correctly apply a 1:1 aspect ratio.
.square {
aspect-ratio: [1];
width: 200px;
background-color: coral;
}The correct syntax for aspect ratio uses a slash, like 1/1, not a colon or dash.
Fill both blanks to create a responsive video container with a 16:9 aspect ratio and a max width of 600px.
.video-container {
aspect-ratio: [1];
max-width: [2];
background-color: black;
}Use aspect-ratio: 16/9; for widescreen and max-width: 600px; to limit container size.
Fill all three blanks to create a card with a 3:2 aspect ratio, a width of 300px, and a light gray background.
.card {
aspect-ratio: [1];
width: [2];
background-color: [3];
}The card uses aspect-ratio: 3/2; for width to height ratio, width: 300px; for size, and background-color: lightgray; for color.