HTML Dog
跳至导航

鼠标悬停效果 1

当鼠标悬停在上面时会发生变化的图形链接,使用 :hover

HTML

<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>Rollovers 1</title>
	<style>
		body {
			font: 12px arial, helvetica, sans-serif;
		}

		#toucan {
			/* Note: Using the '#toucan' ID selector (targeting elements with 'id="toucan"') instead of a simple 'a' HTML selector (targeting all a elements) so that this doesn't target the link back to HTML Dog at the bottom of the page */
			display: block;
			width: 200px;
			height: 63px;
			background-image: url(/examples/images/toucancombo.jpg);
			text-indent: -999em;
		}

		a:hover {
			background-position: bottom;
		}
	</style>
</head>
<body>
	<p><a href="#" id="toucan">Toucan</a></p>

	<!-- Link back to HTML Dog: -->
	<p><a href="https://htmldog.cn/examples/"><img src="https://htmldog.cn/badge1.gif" alt="HTML Dog"></a></p>
</body>
</html>

输出

查看原文