如何使用 CSS 翻转图片(添加镜像效果)?
cssweb developmentfront end technology更新于 2025/10/4 23:08:17
以下是使用 CSS 翻转图片的代码 −
示例
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
img:hover {
transform: scaleX(-1);
width: 400;
height: 400;
}
</style>
</head>
<body>
<h1>Flipping an Image Example</h1>
<img src="https://i.picsum.photos/id/551/400/400.jpg">
<h1>Hover over the above image to see it mirrored</h1>
</body>
</html>
输出
上述代码将产生以下输出 −

当鼠标悬停在图像上时,图像将镜像如下 −

相关文章
有用资源
css 参考教程 - 该教程包含有关 css 的更多信息:https://www.cainiaomax.com/css/

