We're looking for a user researcher to understand the needs of developers and designers. Is this you or someone you know? Check out the post: https://mzl.la/2IGzdXS

The image-orientation CSS property specifies a layout-independent correction to the orientation of an image. It should not be used for any other orientation adjustments; instead, the transform property should be used with the rotate <transform-function>.

Warning: This property is likely to be deprecated in the near future, with its functionality moved into properties on the <img> and/or <picture> elements, with the possible exception of from-image.

/* <angle> values */
image-orientation: 0deg;
image-orientation: 6.4deg;     /* Rounded to 0deg */
image-orientation: -90deg;     /* Equivalent to 270deg, its normalized
                                  computed value */
image-orientation: from-image; /* Use EXIF data from the image */
image-orientation: 90deg flip; /* Rotate 90deg, and flip it horizontally */
image-orientation: flip;       /* No rotation, only applies a
                                  horizontal flip */

/* Global values */
image-orientation: inherit;
image-orientation: initial;
image-orientation: unset;

Initial value0deg
Applies toall elements
Computed valuean <angle>, rounded to the next quarter turn from 0deg and normalized, that is moduloing the value by 1turn
Animation typediscrete
Canonical orderthe unique non-ambiguous order defined by the formal grammar



The EXIF information contained in the image will be used to rotate the image appropriately.
The <angle> of rotation to apply to the image. It is rounded to the nearest 90deg (0.25turn).
The image is flipped horizontally (i.e., reflected) after the rotation given by the <angle> value is applied. If no <angle> is given, 0deg is used.

Formal syntax

from-image | <angle> | [ <angle>? flip ]

Usage notes

This property is intended only to be used for the purpose of correcting the orientation of images which were shot with the camera rotated. It should not be used for arbitrary rotations; this is why all rotations specified as angles are rounded to the nearest quarter of a turn.

For any purpose other than correcting an image's orientation due to how it was shot or scanned, use a transform property with the rotate keyword to specify rotation. This includes any user-directed changes to the orientation of the image, or changes required for printing in portrait versus landscape orientation.



#image {
  image-orientation: flip; /* Can be changed in the live sample */



Specification Status Comment
CSS Images Module Level 4
The definition of 'image-orientation' in that specification.
Working Draft The from-image and flip keywords have been added.
CSS Images Module Level 3
The definition of 'image-orientation' in that specification.
Candidate Recommendation Initial definition.

Browser compatibility

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support No ?26 No No No
from-image No ?26 No No No
flip No ?26 No No No
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
Basic support No ? ?26 No No No
from-image No ? ?26 No No No
flip No ? ?26 No No No

See also

Document Tags and Contributors

Last updated by: isonic,