image-orientation

The image-orientation CSS property specifies a layout-independent correction to the orientation of an image.

Note: Values other than from-image and none are described as deprecated in the specification.

/* keyword values */
image-orientation: none;
image-orientation: from-image; /* Use EXIF data from the image */

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

/* Optional values, deprecated in CSS */
image-orientation: 90deg; /* Rotate 90deg */
image-orientation: 90deg flip; /* Rotate 90deg, and flip it horizontally */
image-orientation: flip; /* No rotation, only applies a horizontal flip */

Syntax

Values

none

Does not apply any additional image rotation; the image is oriented as encoded or as other CSS property values dictate.

from-image

Default initial value. The EXIF information contained in the image is used to rotate the image appropriately.

<angle>

The <angle> of rotation to apply to the image. It is rounded to the nearest 90deg (0.25turn). Positive values cause the image to be rotated to the right (clockwise), negative values to the left (anti-clockwise).

flip

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.

Description

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. 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.

If used in conjunction with other CSS properties, such as a <transform-function>, any image-orientation rotation is applied before any other transformations.

Formal definition

Initial value from-image
Applies to all elements
Inherited yes
Computed value an <angle>, rounded to the next quarter turn from 0deg and normalized, that is moduloing the value by 1turn
Animation type discrete

Formal syntax

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

Examples

Orienting image from image data

CSS

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

Result

Specifications

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
image-orientation
81
81
26
No
67
13.1
81
81
26
No
13.4
13.0
flip_and_angle
No
No
26-63
No
No
No
No
No
26-63
No
No
No

See also

© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/CSS/image-orientation