Make Font Awesome icons in a circle?

前端 未结 14 1108
情书的邮戳
情书的邮戳 2020-12-02 04:38

I am using font awesome on some project but I have some things that I want to do with font awesome icons, I can easily call an icon like this:



        
相关标签:
14条回答
  • 2020-12-02 05:40

    I like Dave Everitt's answer with the « line-height » but it only works by specifying the « height » and then we have to add « !important » to line-height ...

    .cercle {
        font-size: 2em;
        width: 2em;
        height: 2em;
        text-align: center;
        line-height: 2em!important;
        background: #666;
        color: #fff;
        border-radius: 2em;
    }
    
    0 讨论(0)
  • 2020-12-02 05:42

    try this

    HTML:

    <div class="icon-2x-circle"><i class="fa fa-check fa-2x"></i></div>
    

    CSS:

    i {
        width: 30px;
        height: 30px;
    }
    
    .icon-2x-circle {
        text-align: center;
        padding: 3px;
        display: inline-block;
        -moz-border-radius: 100px;
        -webkit-border-radius: 100px;
        border-radius: 100px;
        -moz-box-shadow: 0px 0px 2px #888;
        -webkit-box-shadow: 0px 0px 2px #888;
        box-shadow: 0px 0px 2px #888;
    }
    
    0 讨论(0)
提交回复
热议问题