I've been trying these font-awesome icons to the center of the page but nothing seems to be working. Here is my code
.center { text-align:center; width:50%; } .icon: { width: 200px; height: 200px; } #icons { display: inline-block; text-align: center; color: black; padding-right: 50px; width: 100px; height: 100px; }
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css"> <div class="center"> <!-- Facebook --> <a href="https://www.facebook.com/faizan.khan.7146" class="icons-lg fb-ic" target="_blank"><i id="icons" class="fa fa-facebook" style="font-size: 65px;"></i></a> <!-- Twitter --> <a href="https://twitter.com/faizan_khan698" class="icons-lg tw-ic" target="_blank"><i id="icons" class="fa fa-twitter" style="font-size: 65px;"></i></a> <!--Github--> <a href="https://github.com/fkhan698" class="icons-sm git-ic" target="_blank"><i id="icons" class="fa fa-github" style="font-size: 65px;"> </i></a> <!--Reddit--> <a href="https://www.reddit.com/user/pakiman698/" class="icons-sm reddit-ic" target="_blank"><i id="icons" class="fa fa-reddit" style="font-size: 65px;"></i></a> </div>
Just add center tag
<center>
<a href="" class="icons-lg fb-ic" target="_blank"><i id="icons" class="fa fa-facebook" style="font-size: 65px;"> </i></a>
<!-- Twitter -->
<a href="" class="icons-lg tw-ic" target="_blank"><i id="icons" class="fa fa-twitter" style="font-size: 65px;"></i></a>
<!--Github-->
<a href="" class="icons-sm git-ic" target="_blank"><i id="icons" class="fa fa-github" style="font-size: 65px;"> </i></a>
<!--Reddit-->
<a href="" class="icons-sm reddit-ic" target="_blank"><i id="icons" class="fa fa-reddit" style="font-size: 65px;"></i></a>
<br>
</center>
If anything goes wrong let me know
https://codepen.io/gvsakhil/pen/ZMoVXY I have added codepen, if needed checkit out
-> Just add margin: 0 auto; in .center class.
.center { text-align:center; width:50%; margin: 0 auto; } .icon: { width: 200px; height: 200px; } #icons { display: inline-block; text-align: center; color: black; padding-right: 50px; width: 100px; height: 100px; }
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css"> <div class="center"> <!-- Facebook --> <a href="https://www.facebook.com/faizan.khan.7146" class="icons-lg fb-ic" target="_blank"><i id="icons" class="fa fa-facebook" style="font-size: 65px;"></i></a> <!-- Twitter --> <a href="https://twitter.com/faizan_khan698" class="icons-lg tw-ic" target="_blank"><i id="icons" class="fa fa-twitter" style="font-size: 65px;"></i></a> <!--Github--> <a href="https://github.com/fkhan698" class="icons-sm git-ic" target="_blank"><i id="icons" class="fa fa-github" style="font-size: 65px;"> </i></a> <!--Reddit--> <a href="https://www.reddit.com/user/pakiman698/" class="icons-sm reddit-ic" target="_blank"><i id="icons" class="fa fa-reddit" style="font-size: 65px;"></i></a> </div>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.