Home > Blockchain >  Font size not changing on social media links
Font size not changing on social media links

Time:11-26

I have added social media links to my website, but when I try and change the font, nothing seems to happen, which is annoying.

I am really unsure why the font is not changing.

HTML code:

 <!DOCTYPE html>
<html>
<head>
<title>My Website</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>

<!-- Add font awesome icons -->
<a href="#" class="fa fa-facebook"></a>


</body>
</html> 

CSS code:

.fa {
  padding: 20px;
  font-size: 30px;
  width: 30px;
  text-align: center;
  text-decoration: none;
  margin: 5px 2px;
  border-radius: 50%;
}

.fa:hover {
    opacity: 0.7;
}

.fa-facebook {
  background: #3B5998;
  color: white;
}

I am trying to change the font size to about 60, but nothing happens.

Why is this happening?

Check it out here: https://jsfiddle.net/2hoxu46j/

Nothing happens when the font is changed.

Please help me out.

CodePudding user response:

So, I got the desired out put by using inline css to change font-size

     <head>
    <title>My Website</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>

     <!-- Add font awesome icons -->
      <a href="#" class="fa fa-facebook" style="font-size: 10px"></a>

CodePudding user response:

As the other answer suggested you can use inline css or important in the css. You could also chaning the size by targeting the Pseudo-element like this:

a::before{
  font-size:50px;
}

.fa {
  padding: 20px;
  font-size: 30px;
  width: 30px;
  text-align: center;
  text-decoration: none;
  margin: 5px 2px;
  border-radius: 50%;
}

.fa:hover {
    opacity: 0.7;
}

.fa-facebook {
  background: #3B5998;
  color: white;
}
a::before{
  font-size:50px;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<a href="#" class="fa fa-facebook"></a>
<iframe name="sif1" sandbox="allow-forms allow-modals allow-scripts" frameborder="0"></iframe>

CodePudding user response:

I think this is the best way to use font awesome icons.

<a href="#"><i class="fa fa-facebook"></i></a>

and then

i.fa {
 font-size: 10px;
}

This way you don't need

  • the !important flag
  • inline css
  • Related