<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style>
.l1{ overflow:hidden; }
.l1>ul{ list-style:none;}
.l1>ul>li{ overflow:hidden;width:300px; height:371px; float:left; }
.l1 img{transition:0.5s;}
.l1 img:hover{ margin-left:-10px;}
</style>
</head>
<body>
<div class="l1">
<ul>
<li>
<img src="images/test.jpg" alt="" width="650" height="371" />
</li>
</ul>
</div>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style>
.l1{ overflow:hidden; }
.l1>ul{ list-style:none;}
.l1>ul>li{ overflow:hidden;width:300px; height:371px; float:left; }
.l1 img{transition:0.5s;}
.l1 img:hover{ margin-left:-10px;}
</style>
</head>
<body>
<div class="l1">
<ul>
<li>
<img src="images/test.jpg" alt="" width="650" height="371" />
</li>
</ul>
</div>
</body>
</html>
这篇博客通过HTML和CSS展示了如何实现图片在鼠标悬停时的定向移动效果。使用了CSS的过渡属性`transition`来平滑改变图片的`margin-left`值,实现了图片向左平滑移动的效果。
1330

被折叠的 条评论
为什么被折叠?



