Font Awesome 5 - how to put an icon inside a circle?

前端 未结 1 1431
半阙折子戏
半阙折子戏 2020-12-18 10:39

I\'m trying to put some Font Awesome icons over a div element, making it look like a circle that contains the icons. There are in total three icons inside a circle each, and

相关标签:
1条回答
  • 2020-12-18 11:35

    Font Awesome already allow this, you don't need to do it yourself:

    .custom .fa-circle:before {
      border-radius: 50%;
      background: linear-gradient(red, blue);
      color: transparent;
    }
    <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.12.0/css/all.css">
    
    <span class="fa-stack fa-2x">
        <i class="far fa-circle fa-stack-2x"></i>
        <i class="fab fa-python fa-stack-1x"></i>
    </span>
    <span class="fa-stack fa-2x">
        <i class="fas fa-circle fa-stack-2x" style="color:lightblue"></i>
        <i class="fab fa-python fa-stack-1x "></i>
    </span>
    <span class="fa-stack fa-2x">
        <i class="fas fa-circle fa-stack-2x" style="color:blue"></i>
        <i class="fab fa-facebook-f fa-stack-1x fa-inverse"></i>
    </span>
    <span class="fa-stack fa-2x">
        <i class="fas fa-circle fa-stack-2x" ></i>
        <i class="fab fa-twitter fa-stack-1x fa-inverse"></i>
    </span>
    
    <span class="fa-stack fa-2x custom">
        <i class="fas fa-circle fa-stack-2x" ></i>
        <i class="fab fa-twitter fa-stack-1x fa-inverse"></i>
    </span>

    Related: https://fontawesome.com/how-to-use/on-the-web/styling/stacking-icons

    0 讨论(0)
提交回复
热议问题