Reputation: 83
I'm trying to center the social media icons within the footer, but for some reason when I edit the code there is still no change. Can anyone help?
footer {
background-color: #FFF;
color: white;
padding: 15px;
}
.fa{
color: black;
font-size: 50px;
}
<div class="container">
<footer>
<div class="footer-social-icons">
<a href="#" class="fa fa-facebook"></a>
<a href="#" class="fa fa-instagram"></a>
</div>
</footer>
</div>
</div>
Upvotes: 0
Views: 6268
Reputation: 53
You have three options to this:
.social{
display: block;
width: 20%;
margin: auto;
}
<!DOCTYPE html>
<html>
<head>
<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>
<div class="social">
<a href="#" class="fa fa-facebook"></a>
<a href="#" class="fa fa-twitter"></a>
</div>
</body>
</html>
Upvotes: 1
Reputation: 272
You can achieve this with the help of display: flex property too.
.footer-social-icons{
display:flex;
justify-content:center;
width:100%;
}
Upvotes: 0
Reputation: 3809
Symply align your text in the footer
to center with text-align: center;
.
footer {
...
text-align: center;
}
footer {
background-color: #FFF;
color: white;
padding: 15px;
text-align: center;
}
.fa{
color: black;
font-size: 50px;
}
<div class="container">
<footer>
<div class="footer-social-icons">
<a href="#" class="fa fa-facebook">F</a>
<a href="#" class="fa fa-instagram">I</a>
</div>
</footer>
</div>
</div>
Upvotes: 0