html - Color css property not affecting color of font awesome icons -
i'm unable change color of font awesome icons in our project (using color property in css). think way we're loading our font awesome icons might affecting our ability change color.
before marks duplicate, please take @ jsfiddle below.
you see, html (at lines 7 , 10) we're loading in pre-defined set of fa icons our own server. because, due nature of organisation's work, we're not permitted load external files.
https://jsfiddle.net/moosefetcher/dnjjy015/1/
here html:
<div class="page"> <div id="fb-user-research"> <span class="fb-checkbox"> <input id="fb-user-research-checkbox" type="checkbox" name="fb-checkbox"/> <label for="fb-user-research-checkbox" id="fb-visible-checkbox"> <svg class="unchecked fa-square-0"> <use xlink:href="~/areas/cl/content/app/images/icons/icon-svg-defs.svg#fa-square-o" /> </svg> <svg class="checked fa-check-square"> <use xlink:href="~/areas/cl/content/app/images/icons/icon-svg-defs.svg#fa-check-square" /> </svg> </label> </span> <div id="fb-user-research-texts"> <p>placeholder text here</p> <p>disclaimer here.</p> </div> <div class="clear"></div> </div> </div>
and here's css:
.page { background-color: #000000; height: 400px; padding: 15px; } #fb-user-research { border-radius: 3px; border: 1px solid #333333; margin: 44px 0px 14px 0px; padding: 15px 15px; } #fb-user-research input { border-radius: 2px; background-color: #333333; } #fb-user-research input { float: left; } #fb-user-research #fb-user-research-texts { width: 90%; float: left; } #fb-user-research div p { margin-bottom: 4px; } #fb-user-research div p:first-child { color: #ffffff; } #fb-user-research div p:last-child { color: #888888; font-size: 0.75em; } .fb-checkbox { margin-right: 20px; } #fb-user-research #fb-user-research-texts { width: 85%; float: left; } .fb-checkbox > [type="checkbox"] { width: 0; height: 0; display: none; opacity: 0; } .fb-checkbox { position: relative; float: left; margin-right: 10px; } .fb-checkbox > input[type=checkbox]:checked ~ #fb-visible-checkbox .checked { display: inline-block; opacity: 1; color: #0099dd; } .fb-checkbox > input[type=checkbox]:checked ~ #fb-visible-checkbox .unchecked { display: none; opacity: 0; } #fb-visible-checkbox > svg { position: relative; top: 0px; left: 0px; width: 18px; height: 18px; cursor: pointer; font-size: 18px; } #fb-visible-checkbox .unchecked { background-color: grey; color: #ffffff; } #fb-visible-checkbox .checked { background-color: lightgrey; color: #0099dd; display: none; opacity: 0; } .clear { clear: both; }
to clear, when working in dev environment, icons load fine. question i'm asking is:
is loading font awesome icons (as shown in jsfiddle) affecting our ability change color?
thanks help!
you not using font version of fontawesome icons. using svg versions.
svg doesn't use color
change fill color of shapes. uses fill
.
you need @ least change css using fill
instead of color
. might need make other changes, can't tell sure because haven't included external svg file.
also, aware external <use>
references, using, don't work in ie (last checked). may need inline svg in html if care that.
Comments
Post a Comment