2017-02-15 8 views
1

私のWebページのCSSにSVGアイコンがあります。 ChromeとSafariで表示され、反応がありますが、Firefoxではまったく表示されません。私はcontent:urlでSVGにリンクする方法で問題があり、回避策がありますか?FirefoxのSVG CSSコンテンツ

CSS:

#about-linked{ 
     content:url('./info.svg'); 
     position: absolute; 
     background-color: rgba(24, 24, 24, 0.0); 
     z-index: 10; 
     border-radius: 5px; 
     bottom: 1%; 
     left: 1%; 
     height: 35px; 
     width: 35px; 
     opacity: 0.7; 
     display: none 
    } 

    #about-linked:hover{ 
     cursor: pointer; 
     opacity: 0.9; 
    } 

#changeLayer{ 
    content:url(https://cdn1.iconfinder.com/data/icons/pixel-perfect-at-16px-volume-1/16/5049-512.png); 
    position: absolute; 
    background-color: rgba(24, 24, 24, 0.0); 
    z-index: 3; 
    border-radius: 5px; 
    top: 10%; 
    left: 26%; 
    height: 35px; 
    width: 35px; 
    opacity: 0.7; 
} 

HTML:

<div id='map'> 
    <div id='program_title'> 
     <span id="myspan">TITLE</span> 
    </div> 

    <div id ='about-linked'></div> 
    </div> 

<div id='changeLayer'></div> 

注:background-imagecontentに変更すると、アイコンは対照的に生成し、望ましくないパターン:たとえば(Chromeの)content:と、私が手:

enter image description here

はなく、background-image:で私が手:

enter image description here

答えて

0

contentのみ::before::after擬似要素で動作します。それ以外のブラウザでも対応可能ですが、それはagainst official documentationです。

良いニュースは、あなたが作る必要がある唯一の変更があるということです: `#のchangeLayer`アイコンで

#changeLayer::before{ 
    ... 
+0

、私は' :: before'を使用する場合、画像が膨大になるとの半分を占めます画面... –

+0

最初に背景画像とは対照的に、コンテンツを介して読み込む理由はありますか? –

+0

更新された質問を確認してください。アイコンの代わりに背景の塗りつぶしパターンがあるからです。 –

関連する問題