大网数据广告活动
Web 标准与前端开发

image-orientation

· 52CE 我爱测

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

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

[!NOTE]

  • 该属性不是用来对图片进行任意角度旋转的,它是用来修正那些带有不正确的预设方向的图片的。因此该属性值会被四舍五入到 90 度的整数倍。
  • 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

语法

/* 关键字值 */
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
    • : 对图片进行水平翻转,先进行第二个参数执行的旋转,再进行此次翻转。

形式语法

形式定义

示例

规范

浏览器兼容性

参见

  • 其他和图片相关的 CSS 属性:image-rendering、image-resolution。

来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
MDN Web Docs / Mozilla 贡献者
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 2.5

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。