「img src」をCSSファイルに設定しようとしています。私は使用できるさまざまな方法を研究しましたが、それはまだ機能していません。 ::後にcssを入れたら、Chromeでは動作しませんが、Firefoxではさまざまなスタイルで動作します。あなたがbutton
要素にbackground-image
として画像を設定することができます https://jsfiddle.net/er1txx0z/Firefoxのimg content urlとの非互換性
<label class="control-label"></label>
<button id="btn1" class="btn btn-warning shadow dcweb_search" disabled="true">
<img class="dcweb_search_img" />
</button>
<style>
.dcweb_search{
height: 60px;
width: 60px;
position: relative;
top:-17px
}
.dcweb_search_img{
width:40px;
content:url('https://api.icons8.com/download/c5c8b5ba35e008ea471e9a53c5fa74c03ef6e78c/iOS7/PNG/256/Very_Basic/search-256.png');
}
</style>
FirefoxはChromeのと同じように、コンテンツプロパティをサポートしていません。 http://stackoverflow.com/questions/12262118/content-url-is-not-working-in-firefox –
なぜ 'img'タグ自体にsrcを設定しないのですか? –
CSSファイルではイメージのSRCを設定できないため、代わりにcontent-urlを使用する必要があります。ホバー上のリンクの画像が違うので、HTMLタグではできません! –