HTML
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>笔下光年</title>
</head>
<body>
<p>逐步改变 Image 元素的 vertical-align 属性,从 0 到 100px:<p>
<p><img id="myIMG" src="smiley.gif" width="32" height="32">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius.
</p>
<p>vertical-align 属性支持动画效果。</p>
<p><b>注意:</b>Chrome 浏览器不支持 vertical-align 属性。</p>
<p><b>注意:</b>Internet Explorer 9 及更早 IE 版本不支持 CSS 动画。</p>
</body>
</html>
CSS
#myIMG {
vertical-align: 50px;
-webkit-animation: mymove 5s infinite; /* Chrome, Safari, Opera */
animation: mymove 5s infinite;
}
/* Chrome, Safari, Opera */
@-webkit-keyframes mymove {
50% {vertical-align: 100px;}
}
/* Standard syntax */
@keyframes mymove {
50% {vertical-align: 100px;}
}