Make Font Awesome icons in a circle?

前端 未结 14 1279
情书的邮戳
情书的邮戳 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:33

    This is the approach you don't need to use padding, just set the height and width for the a and let the flex handle with margin: 0 auto.

    .social-links a{
      text-align:center;
    	float: left;
    	width: 36px;
    	height: 36px;
    	border: 2px solid #909090;
    	border-radius: 100%;
    	margin-right: 7px; /*space between*/
        display: flex;
        align-items: flex-start;
        transition: all 0.4s;
        -webkit-transition: all 0.4s;
    } 
    .social-links a i{
    	font-size: 20px;
        align-self:center;
    	color: #909090;
        transition: all 0.4s;
        -webkit-transition: all 0.4s;
        margin: 0 auto;
    }
    .social-links a i::before{
      display:inline-block;
      text-decoration:none;
    }
    .social-links a:hover{
      background: rgba(0,0,0,0.2);
    }
    .social-links a:hover i{
      color:#fff;
    }
    
    
    

提交回复
热议问题