How do you ensure that an image maintains its aspect ratio when resized?
- Set the max-width property to 100%.
- Use a fixed width and height in pixels.
- Use the aspect-ratio CSS property.
- Use the width attribute and leave the height attribute unset (or vice versa).
Ensuring an image maintains its aspect ratio when resized is critical for consistent design and user experience. By setting only one dimension (either width or height) and leaving the other unset, the browser will automatically scale the unset dimension proportionally, preserving the image's original aspect ratio.
Loading...
Related Quiz
- Which HTML tag is used to create a dropdown list in a form?
- The _______ CSS property is used to control the line-breaking behavior of an inline element.
- A navigation list can be created using the _____ element, often used in combination with the _____ element for structured navigation.
- The ______ input type is used to create a radio button in a form.
- How does the placement of "thead" and "tfoot" in the code affect the visual rendering of the table?