您可以使用CSS3transition属性color在鼠标悬停时平滑地设置元素文本的动画,例如文本的段落或超链接。
让我们看一个示例,以了解其基本工作原理:
例试试这个代码»
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>CSS Smooth Text Color Transition</title>
<style>
a {
margin: 20px;
-webkit-transition: color 1s; /* For Safari 3.0 to 6.0 */
transition: color 1s; /* For modern browsers */
}
a:hover {
color: #ff0000;
}
</style>
</head>
<body>
<h1><a href="#">Hover on me</a></h1>
</body>
</html>
如需转载,请注明文章出处和来源网址:http://www.divcss5.com/html/h61095.shtml