You can maintain an image's aspect ratio by setting the max-width to 100% and the height to auto in CSS.