Home > Enterprise >  how to style Font Awesome Directional Icons
how to style Font Awesome Directional Icons

Time:01-30

I am trying to reduce the width of the font awesome directional arrow through external css (I need it to be done through external css).But i am not able to increase the font-size and while doing through inline css its working fine

.fa-arrow-circle-left
{

  color:red;
  font-size:48px;
}
<!DOCTYPE html>
<html>
<head>
<title>Font Awesome Icons</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>

<h1>fa fa-arrow-circle-left</h1>


<i  ></i>
<br>



<!-- <p>Unicode:</p>
<i style="font-size:24px" >&#xf0a8;</i> -->

</body>
</html>

CodePudding user response:

Alrighty, so I played with this in a JSFiddle and found that you need to wrap the <i ></i> in a container. For me, I used a <p> element, but I'm sure this can be done with <div>, <a>, <button>, etc.

All you need to do, after wrapping the icon in a container, is just add the styles to the container:

p {
  color: red;
  font-size: 50px;
}
<!DOCTYPE html>
<html>

<head>
  <title>Font Awesome Icons</title>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>

<body>

  <h1>fa fa-arrow-circle-left</h1>


  <p>
    <i ></i>
  </p>
  <br>

</body>

</html>

CodePudding user response:

There are a lot ways to do it but if you really want to do it with an external CSS just put the icon in a container(wrapper in this case) and define your font-size:"" andi it would be done. But if you use the selector as .fa-arrow-circle-left things wont happen since it already defined in the font-awsome css.

//.fa-arrow-circle-left{
 // color:red;
 // font-size:48px;
//}

.wrapper{
  font-size:45px;
}
<!DOCTYPE html>
<html>

<head>
    <title>Font Awesome Icons</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>

<body>

    <h1>fa fa-arrow-circle-left</h1>

    <div >
        <i ></i>
    </div>





    <!-- <p>Unicode:</p>
<i style="font-size:24px" >&#xf0a8;</i> -->

</body>

</html>

CodePudding user response:

<!DOCTYPE html>
<html>
<head>
<title>Font Awesome Icons</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>

<i ></i>
<i  style="font-size:48px;"></i>
<i  style="font-size:60px;color:red;"></i>

</body>
</html>

  •  Tags:  
  • Related