私はここで説明されている引き戸のテクニックを使用しました:
http://www.oscaralexander.com/tutorials/how-to-make-sexy-buttons-with-css.html
1つだけ例外を除いて、「ホバー」効果のためにもう1つの画像を追加することにしました。
私のコードは、IE8(およびおそらく以前のバージョン)を除くすべてのブラウザーでうまく機能します。
a.submit-button:activeおよびa.submit-button:activeスパンは、単に「ホバー」によってブロックされ、機能しません。
誰かがこれの解決策を知っていますか?
これはテストページです:http ://websvit.com/temp/button.html
よろしくお願いします!
<style type="text/css">
.clear { /* generic container (i.e. div) for floating buttons */
overflow: hidden;
width: 100%;
}
a.submit-button {
background: transparent url('images/button-1b.png') no-repeat scroll top right;
color: #fff;
display: block;
float: left;
font: bold 13px sans-serif, arial;
height: 28px;
margin-right: 6px;
padding-right: 18px; /* sliding doors padding */
text-decoration: none;
outline: none;
}
a.submit-button span {
background: transparent url('images/button-1a.png') no-repeat;
display: block;
line-height: 14px;
padding: 6px 0 8px 24px;
}
a.submit-button:hover {
background-position: right -28px;
outline: none; /* hide dotted outline in Firefox */
color: #fff;
}
a.submit-button:hover span {
background-position: 0px -28px;
}
a.submit-button:active {
background-position: right -56px;
color: #e5e5e5;
outline: none;
}
a.submit-button:active span {
background-position: 0px -56px;
padding: 7px 0 7px 24px; /* push text down 1px */
}
</style>
そしてこれはボタンです:
<div class="clear">
<a class="submit-button" href="#" onclick="this.blur();"><span>Hello All</span></a>
</div>
代替テキストhttp://websvit.com/temp/button-1a.png 代替テキストhttp://websvit.com/temp/button-1b.png