image-orientation

  • Revision slug: Web/CSS/image-orientation
  • Revision title: image-orientation
  • Revision id: 460357
  • Created:
  • Creator: teoli
  • Is current revision? No
  • Comment

Revision Content

{{CSSRef}}
{{SeeCompatTable}}

Summary

The image-orientation CSS property describes how to correct the default orientation of an image.

Note:

  • This property is not intended to perform arbitrary rotation on an image, but to correct erroneous orientation. That's why it is rounded to the nearest quarter of turn.
  • Similarly this property is not intented to handle the layout -> portrait changing. As image-orientation affects only images, it won't work: the changes must happen at the layout-level

{{cssbox("image-orientation")}}

Syntax

Formal syntax: {{csssyntax("image-orientation")}}
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 */

image-orientation: inherit

Values

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

Examples

Specifications

Specification Status Comment
{{SpecName('CSS4 Images', '#image-orientation', 'image-orientation')}} {{Spec2('CSS4 Images')}} The from-image and flip keywords have been added.
{{SpecName('CSS3 Images', '#image-orientation', 'image-orientation')}} {{Spec2('CSS3 Images')}} Initial specification.

Browser compatibility

{{CompatibilityTable}}
Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support {{CompatNo}} {{CompatGeckoDesktop(26)}} {{CompatNo}} {{CompatNo}} {{CompatNo}}
from-image {{CompatNo}} {{CompatGeckoDesktop(26)}} {{CompatNo}} {{CompatNo}} {{CompatNo}}
flip {{CompatNo}} {{CompatGeckoDesktop(26)}} {{CompatNo}} {{CompatNo}} {{CompatNo}}
Feature Android Firefox Mobile (Gecko) Firefox OS (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support {{CompatNo}} {{CompatGeckoMobile(26)}} {{CompatGeckoFxOS(26)}} {{CompatNo}} {{CompatNo}} {{CompatNo}}
from-image {{CompatNo}} {{CompatGeckoMobile(26)}} {{CompatGeckoFxOS(26)}} {{CompatNo}} {{CompatNo}} {{CompatNo}}
flip {{CompatNo}} {{CompatGeckoMobile(26)}} {{CompatGeckoFxOS(26)}} {{CompatNo}} {{CompatNo}} {{CompatNo}}

See also

  • Other image-related CSS properties: {{cssxref("image-rendering")}}, {{cssxref("image-resolution")}}.

Revision Source

<div>
  {{CSSRef}}</div>
<div>
  {{SeeCompatTable}}</div>
<h2 id="Summary">Summary</h2>
<p>The <code>image-orientation</code> <a href="/en-US/docs/CSS">CSS</a> property describes how to correct the default orientation of an image.</p>
<div class="note style-wrap">
  <p><strong>Note:</strong></p>
  <ul>
    <li>This property is not intended to perform arbitrary rotation on an image, but to correct erroneous orientation. That's why it is rounded to the nearest quarter of turn.</li>
    <li>Similarly this property is not intented to handle the layout -&gt; portrait changing. As <code>image-orientation</code> affects only images, it won't work: the changes must happen at the layout-level</li>
  </ul>
</div>
<p>{{cssbox("image-orientation")}}</p>
<h2 id="Syntax">Syntax</h2>
<pre class="twopartsyntaxbox">
<a href="/en-US/docs/CSS/Value_definition_syntax" title="CSS/Value_definition_syntax">Formal syntax</a>: {{csssyntax("image-orientation")}}
</pre>
<pre>
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 */

image-orientation: inherit
</pre>
<h3 id="Values">Values</h3>
<dl>
  <dt>
    <code>from-image</code></dt>
  <dd>
    The EXIF information contained in the image will be used to rotate the image appropriately.</dd>
  <dt>
    <code>&lt;angle&gt;</code></dt>
  <dd>
    The {{xref_cssangle}} of rotation to apply to the image. It is rounded to the nearest <code>90deg</code> (<code>0.25turn</code>).</dd>
  <dt>
    <code>flip</code></dt>
  <dd>
    The image is flipped horizontally, that is reflected, after the rotation given by the {{xref_cssangle}} value. If no {{xref_cssangle}} is given, <code>0deg</code> is used.</dd>
</dl>
<h2 id="Examples">Examples</h2>
<h2 id="Specifications">Specifications</h2>
<table class="standard-table">
  <thead>
    <tr>
      <th scope="col">Specification</th>
      <th scope="col">Status</th>
      <th scope="col">Comment</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>{{SpecName('CSS4 Images', '#image-orientation', 'image-orientation')}}</td>
      <td>{{Spec2('CSS4 Images')}}</td>
      <td>The <code>from-image</code> and <code>flip</code> keywords have been added.</td>
    </tr>
    <tr>
      <td>{{SpecName('CSS3 Images', '#image-orientation', 'image-orientation')}}</td>
      <td>{{Spec2('CSS3 Images')}}</td>
      <td>Initial specification.</td>
    </tr>
  </tbody>
</table>
<h2 id="Browser_compatibility" name="Browser_compatibility">Browser compatibility</h2>
<div>
  {{CompatibilityTable}}</div>
<div id="compat-desktop">
  <table class="compat-table">
    <tbody>
      <tr>
        <th>Feature</th>
        <th>Chrome</th>
        <th>Firefox (Gecko)</th>
        <th>Internet Explorer</th>
        <th>Opera</th>
        <th>Safari (WebKit)</th>
      </tr>
      <tr>
        <td>Basic support</td>
        <td>{{CompatNo}}</td>
        <td>{{CompatGeckoDesktop(26)}}</td>
        <td>{{CompatNo}}</td>
        <td>{{CompatNo}}</td>
        <td>{{CompatNo}}</td>
      </tr>
      <tr>
        <td><code>from-image</code></td>
        <td>{{CompatNo}}</td>
        <td>{{CompatGeckoDesktop(26)}}</td>
        <td>{{CompatNo}}</td>
        <td>{{CompatNo}}</td>
        <td>{{CompatNo}}</td>
      </tr>
      <tr>
        <td><code>flip</code></td>
        <td>{{CompatNo}}</td>
        <td>{{CompatGeckoDesktop(26)}}</td>
        <td>{{CompatNo}}</td>
        <td>{{CompatNo}}</td>
        <td>{{CompatNo}}</td>
      </tr>
    </tbody>
  </table>
</div>
<div id="compat-mobile">
  <table class="compat-table">
    <tbody>
      <tr>
        <th>Feature</th>
        <th>Android</th>
        <th>Firefox Mobile (Gecko)</th>
        <th><strong>Firefox OS (Gecko)</strong></th>
        <th>IE Phone</th>
        <th>Opera Mobile</th>
        <th>Safari Mobile</th>
      </tr>
      <tr>
        <td>Basic support</td>
        <td>{{CompatNo}}</td>
        <td>{{CompatGeckoMobile(26)}}</td>
        <td>{{CompatGeckoFxOS(26)}}</td>
        <td>{{CompatNo}}</td>
        <td>{{CompatNo}}</td>
        <td>{{CompatNo}}</td>
      </tr>
      <tr>
        <td><code>from-image</code></td>
        <td>{{CompatNo}}</td>
        <td>{{CompatGeckoMobile(26)}}</td>
        <td>{{CompatGeckoFxOS(26)}}</td>
        <td>{{CompatNo}}</td>
        <td>{{CompatNo}}</td>
        <td>{{CompatNo}}</td>
      </tr>
      <tr>
        <td><code>flip</code></td>
        <td>{{CompatNo}}</td>
        <td>{{CompatGeckoMobile(26)}}</td>
        <td>{{CompatGeckoFxOS(26)}}</td>
        <td>{{CompatNo}}</td>
        <td>{{CompatNo}}</td>
        <td>{{CompatNo}}</td>
      </tr>
    </tbody>
  </table>
</div>
<h2 id="See_also">See also</h2>
<ul>
  <li>Other image-related CSS properties: {{cssxref("image-rendering")}}, {{cssxref("image-resolution")}}.</li>
</ul>
Revert to this revision