12

This question has been asked before in this post. But I don't think its still working with the new font-awesome because they use svg and path elements.

This question is about having a border around the icon, instead of having it around the outer circle.


Some of the solutions found that I tried, but did not work:

.fa-female, .fa-music{
  color: #BBB;
}

.fa-female{
  -webkit-text-fill-color: #BBB;
  -webkit-text-stroke-width: 1px;
  -webkit-text-stroke:4px #00FF00;
}

.fa-music{
  text-shadow: 0px 0px 3px #00FF00;
}
<script defer src="https://use.fontawesome.com/releases/v5.0.6/js/all.js"></script>
 
<!-- Female Icon --> 
<span class="fa-layers fa-fw fa-8x" style="color: rgb(190, 53, 48)">
  <i class="fas fa-circle"></i>
  <i class="fas fa-female fa-inverse" data-fa-transform="shrink-6 fa-border"></i>
</span>

<!-- Music Icon --> 
<span class="fa-layers fa-fw fa-8x" style="color: rgb(190, 53, 48)">
   <i class="fas fa-circle"></i>
   <i class="fas fa-music fa-inverse" data-fa-transform="shrink-8 fa-border"></i>
</span>

<i class="fas fa-music fa-inverse fa-5x" style="color: black;"></i>

Edit: Solution that worked in a codesnippet
Solution by reiallenramos

.fa-music g g path {
  stroke: black;
  stroke-width: 10;
}
<script defer src="https://use.fontawesome.com/releases/v5.0.6/js/all.js"></script>

<!-- Music Icon --> 
<span class="fa-layers fa-fw fa-8x" style="color: rgb(190, 53, 48)">
   <i class="fas fa-circle"></i>
   <i class="fas fa-music fa-inverse" data-fa-transform="shrink-8 fa-border"></i>
</span>
Jeremy
  • 1,384
  • 3
  • 10
  • 24

4 Answers4

16

I had to dissect the internals of font-awesome.

.fa-music g g path {
  stroke: black;
  stroke-width: 10;
}
reiallenramos
  • 1,235
  • 2
  • 21
  • 29
6

The new FontAwesome way would be layers: https://fontawesome.com/how-to-use/svg-with-js#layering

<script defer src="https://use.fontawesome.com/releases/v5.0.6/js/all.js"></script>
 
<span class="fa-layers fa-fw fa-5x">
   <i class="fas fa-circle" style="color:black"></i>
   <i class="fas fa-circle" data-fa-transform="shrink-3" style="color:Tomato"></i>
   <i class="fa-inverse fas fa-female" data-fa-transform="shrink-6"></i>
</span>
Ron van der Heijden
  • 14,803
  • 7
  • 58
  • 82
3

Please make stroke colour same as the icon background icon, then it will visible like the icon stroke is reduce.

Please try to use below style.

-webkit-text-stroke:4px rgb(190, 53, 48)

subir biswas
  • 371
  • 2
  • 5
  • 14
-1

I'm guessing you want a round border around the red icon?

You can add a new circle inside the layer span:

        <!-- Music Icon -->
    <span class="fa-layers fa-fw fa-8x fa-border" style="color: rgb(190, 53, 48)">
         <i class="fas fa-circle" style="color: black"></i>
        <i class="fas fa-circle" data-fa-transform="shrink-1"></i>
       <i class="fas fa-music fa-inverse" data-fa-transform="shrink-8"></i>
    </span>
Steven Kuipers
  • 809
  • 7
  • 19