Y
Y
YuriyCherniy2020-05-24 23:37:56
Bootstrap
YuriyCherniy, 2020-05-24 23:37:56

How to center footer elements in mobile version?

Now in the desktop version the footer looks like this:
5ecad9d320c02973926098.png
in the mobile version it looks like this:
5ecad9f26b177892015425.png
How to make the line with the phone and social icons displayed in the center in the mobile version?
The current implementation looks like this:

<footer class="footer mt-2">
    <div class="container my-2">
      <div class="d-sm-flex justify-content-between">
        <div class="footer-left">
          <div class="row">
            <img src="{% static 'phone.svg' %}" class="mx-2 mb-2 my-lg-0">
            <h4 class="my-auto">{{ social_links.phone_number }}</h4>
          </div>
        </div>
        <div class="footer-right">
          {% if social_links.market %}
          <a href="{{ social_links.market }}"><img src="{% static 'cart.svg' %}" class="mr-3"></a>
          {% endif %}

          {% if social_links.instagram %}
          <a href="{{ social_links.instagram }}"><img src="{% static 'instagram1.svg' %}" class="mr-3"></a>
          {% endif %}

          {% if social_links.vk %}
          <a href="{{ social_links.vk }}"><img src="{% static 'vk.svg' %}" class="mr-3"></a>
          {% endif %}
        </div>
      </div>
    </div>
  </footer>

I am using Bootstrap 4.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor, 2020-05-24
@loonny

Use the justify-content-center class to center content.
Also don't forget that justify-content can be used with sm | md | lg | xl .
That is, to make justify-content-center only for screens <576px, and leave justify-content-between for the rest, you need to do this:

<div class="d-flex justify-content-center justify-content-sm-center">

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question