图像翻转与子画面

利用CSS,可在用户将光标悬停在一个连接或按钮上时为连接或按键创建另一种样式(称为翻转)还可在用户单击它时创建第三种样式。

<html>
    <head>
 <title>TODO supply a title</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
	<style type="text/css">
	a.button {
		height: 36px;
		background-image: url("button-sprite.jpg");
		text-indent: -9999px;
		display: inline-block;}
	a#add-to-basket {
		width: 174px;
		background-position: 0px 0px;}
	a#framing-options {
		width: 210px;
		background-position: -175px 0px;}
	a#add-to-basket:hover {
		background-position: 0px -40px;}
	a#framing-options:hover {
		background-position: -175px -40px;}
	a#add-to-basket:active {
		background-position: 0px -80px;}
	a#framing-options:active {
		background-position: -175px -80px;}
	</style>
</head>
<body>
	<a class="button" id="add-to-basket">Add to basket</a>
	<a class="button" id="framing-options">Framing options</a>
</body>
</html>

 

posted @ 2018-08-11 17:27  梦人亭  阅读(130)  评论(0编辑  收藏  举报