-1

I have a section in my login form to log in with social networks like Facebook and Google, but the problem is the I can't center the icons under the div and keep it responsive always.

Please help me!!.

.row {
  background: #f8f9fa;
  margin-top: 20px;
}

.col {
  border: solid 1px #6c757d;
  padding: 10px;
}
<script src="https://code.jquery.com/jquery-3.4.1.slim.js"></script>
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.css" rel="stylesheet" />
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.js"></script>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.css" rel="stylesheet" />

<div class="row my-5 justify-content-center">
  <div class="text-md-right text-sm-left col-sm-6 col-md-5">
    <p>Sign With</p>
  </div>
  <div class="col-md-4">
    <a href="#" class="">
      <img src="https://i.ibb.co/y5ZdM7r/ICON-FB.png" class="float-center">
    </a>
    <a href="#" class="">
      <img src="https://i.ibb.co/c3g5tdd/ICON-GOOGLE.png" class="ml-2 float-center">
    </a>
  </div>
</div>

Thank you!

Elias Vargas
  • 1,126
  • 1
  • 18
  • 32

1 Answers1

2

In Bootstrap classes, add: d-flex justify-content-center align-items-center to the div wrapping the a tags.

In regular CSS without Bootstrap, this is how you center:

You should give the parent div (the one wrapping the a tags) the following CSS properties:

display: flex;
align-items: center;
justify-content: center;
itamar
  • 3,837
  • 5
  • 35
  • 60