Movatterモバイル変換


[0]ホーム

URL:


  1. 面向开发者的 Web 技术
  2. CSS:层叠样式表
  3. CSS 参考
  4. 属性
  5. image-orientation

此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。

View in EnglishAlways switch to English

image-orientation

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2020年4月.

CSS 属性image-orientation 用来修正某些图片的预设方向。

备注:

  • 该属性不是用来对图片进行任意角度旋转的,它是用来修正那些带有不正确的预设方向的图片的。因此该属性值会被四舍五入到 90 度的整数倍。
  • Similarly this property is not intented to handle the layout -> portrait changing. Asimage-orientation affects only images, it won't work: the changes must happen at the layout-level
初始值from-image
适用元素所有元素
是否是继承属性
计算值an<angle>, rounded to the next quarter turn from0deg and normalized, that is moduloing the value by1turn
动画类型离散值

语法

css
/* 关键字值 */image-orientation: none;image-orientation: from-image; /* 使用图片的 EXIF 数据 *//* 全局值 */image-orientation: inherit;image-orientation: initial;image-orientation: revert;image-orientation: revert-layer;image-orientation: unset;

属性值

from-image

根据图片的 EXIF 数据来旋转图片,EXIF 中有一个控制图片旋转度的属性。

<angle>

图片旋转值<angle> , 会被自动四舍五入到90deg (0.25turn) 的整数倍。

flip

对图片进行水平翻转,先进行第二个参数执行的旋转,再进行此次翻转。

形式语法

初始值from-image
适用元素所有元素
是否是继承属性
计算值an<angle>, rounded to the next quarter turn from0deg and normalized, that is moduloing the value by1turn
动画类型离散值

形式定义

image-orientation =
from-image|
none|
[<angle>||flip]

示例

规范

Specification
CSS Images Module Level 3
# the-image-orientation

浏览器兼容性

参见

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2026 Movatter.jp