css按钮自融入完成基本原理及编码

2021-01-20 11:01 jianzhan
基本原理:运用a标识和i标识各有1个情况组成变成按钮,做到自融入。

拷贝编码
编码以下:

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF⑻">
<style type="text/css">
.btn a{text-decoration:none;}
.btn{display: inline-block; background: url(s_btn.png) no-repeat 0 0; height: 22px; line-height: 22px; color: #666; vertical-align:top;}
.btn i{display:block;font-style: normal; font-size: 12px; padding: 0 10px; background:url(s_btn.png) no-repeat right ⑵2px; }
.btn:hover{text-decoration: none;color:#4c8136;background-position: 0 ⑷4px;}
.btn:hover i{background-position: right ⑹6px;}
.btn:active{background-position: 0 ⑻8px;}
.btn:active i{background-position: right ⑴10px;}
.btn_disabled, .btn_disabled:hover{background: url(../img/s_btn.png) no-repeat 0 ⑴32px;cursor: default;}
.btn_disabled i, .btn_disabled:hover i, .s_btn_disabled:active i{background-position: right ⑴54px;color:#999;}
</style>
</head>
<body>
<a href="#" class="btn"> <i>这是按钮</i> </a>
<a href="#" class="btn"> <i>按钮</i> </a>
</body>
</html>

实际效果: