Home > Article > Web Front-end > Why are my images upside down? A look at the `image-orientation` CSS property.
Image Orientation Issues with img Tag
When displaying an image using the img tag, sometimes the orientation may be incorrect, resulting in an upside-down image. This issue stems from image metadata that specifies the intended orientation of the photo.
To address this problem, CSS has introduced the image-orientation property. By adding the following CSS to your style sheet, you can correct the image orientation:
<code class="css">img { image-orientation: from-image; }</code>
As of the time of this answer (January 25, 2016), Firefox and iOS Safari (with a prefix) support the image-orientation property. However, issues may still arise with Safari and Chrome. Mobile Safari appears to handle orientation natively without the need for the CSS.
Until broader browser support becomes available, we can expect these orientation issues to persist.
The above is the detailed content of Why are my images upside down? A look at the `image-orientation` CSS property.. For more information, please follow other related articles on the PHP Chinese website!