div+css Implement Adaptive Width button _ Experience Exchange
Take a look at the picture first:
The principle is to combine a full rounded rectangle with a label and a span tag using the left and right alignment of the background. Then slide the picture through the Hover tab. And all you need is a picture:
OK, look at the code.
Css:
The code is as follows:
*{margin:0; padding:0;} body{padding:10px; font-size:12px;} h1{margin:0; padding:10px 0; font-size:14px; font-weight:bold;} A{background:url (1.gif) left 0; color: #fff; text-decoration:none; height:30px; float:left; cursor:hand; margin:0 5px 0 0;} A:hover{background:url (1.gif) left-30px;height:30px;} A span{background:url (1.gif) right 0; padding:7px 8px 7px 0; margin:0 0 0 8px; Float:left; height:16px;} A:hover Span{background:url (1.gif) right-30px; color: #000; padding:7px 8px 7px 0; margin:0 0 0 8px; height:16px; }
Html:
The code is as follows:
<body>
Demonstrate:
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
The above is DIV+CSS implementation of the Adaptive Width button _ Experience Exchange content, more relevant content please pay attention to topic.alibabacloud.com (www.php.cn)!