1. 程式人生 > >CCS例項---寬度自由調節button,圖片切換

CCS例項---寬度自由調節button,圖片切換

 

<html lang="en">

<head>
<meta charset="utf-8"/>
<title>Image Gallery</title>
<style type="text/css">
.btn1{display:inline-block; background:url(./sina_gray_btn.png) no-repeat left top; padding-left:3px; color:#000; font-size:12px; text-decoration:none;}
.btn1 cite{display:block; line-height:26px; padding:0 13px 0 10px; background:url(./sina_gray_btn.png) no-repeat right top;}

.btn1:hover{background-position:0px -28px}
.btn1 cite:hover{background-position:0px -28px}

</style>
</head>
<body>
<div id="div1">
<a href="javascript:" class="btn1"><cite>block方法block方法</cite></a>
</div>
<div style="position:relative;top:200px;width:200px;height:200px;border:2px solid #ddd">
<img src="sina_gray_btn.png"/>
<div>


</body>
</html>