0

私のcssには次のものがあります:

.myclasss:hover {
background: url("images/arw_flogin2.png")  no-repeat; border: none;
display: block;
width: 90px;
height: 50px;

}

私のHTMLでは次のとおりです。

<input type="image" title="" class="myclasss" src="images/arw_flogin1.jpg" />

入力タイプを送信に変更すると機能しますが、画像としては機能しません。

4

2 に答える 2

3

ホバーしていない状態で背景画像を使用する必要があります。の入力とともに次の css を使用します。type="submit"

CSS

.myclasss {
    background: url("images/arw_flogin1.png")  no-repeat; border: none;
    display: block;
    width: 90px;
    height: 50px;

}

.myclasss:hover {
    background: url("images/arw_flogin2.png")  no-repeat; border: none;
}

HTML

<input type="submit" class="myclasss" value="" />

画像タイプの入力を使用すると、属性に設定した画像がsrc前景に適用されます。srcしたがって、ホバー時に背景を変更すると、画像がまだ前景にあるため表示されません。

于 2013-01-04T14:54:46.707 に答える
2

問題は、inputタグの SRC が背景の上に配置されていることです。

Jrod の方法が機能するか、flogin1/2 画像を組み合わせてbackground-position: 0 90pxを使用して読み込み時間を改善することができます。

于 2013-01-04T14:58:48.227 に答える