How to center left alignment in Bootstrap modal

I am very new to HTML / CSS, so I am having problems with the following: the list items (with icons) in this Bootstrap module are correctly left-aligned relative to each other. However, I want the entire list to appear in the center of the modal.

To get list items for left alignment, I have this in my CSS:

.modal-list > li > a {
  color:#333;
  text-decoration: none;
  list-style: none;
  display: block;
  text-align: left;
}  

And here is (what I think) the corresponding HTML:

  <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
        <h4 class="modal-title" id="myModalLabel">Sign up or log in using OpenID</h4>
      </div>
      <div class="modal-body">
        At this time, CloudSim is in beta and by invitation only. If you have received an invite, pick a login option below.
        <!--OpenID options -->
        <ul class="dropdown-menu-modal" style="list-style-type:none;">
            <li>
              <a href="/auth/google"><img class="inline-block"
                 alt="Google" width="46" src="/img/icons/google.svg"/> Google</a>
            </li>
            <li>
              <a href="/auth/yahoo"><img class="inline-block"
                 alt="Yahoo" width="46" src="/img/icons/yahoo.svg"> Yahoo</a>
            </li>
            <li>
              <a href="/auth/aol"><img class="inline-block"
                 alt="AOL" width="46" src="/img/icons/aol.svg"> AOL</a>
            </li>
            <li>
              <a href="/auth/openid"><img class="inline-block"
                 alt="OpenId" width="46" src="/img/icons/openid.svg"> OpenId</a>
            </li>
          </ul>
        <!-- end here -->
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
      </div>
    </div>
  </div>
</div>
<!-- end of modal -->

I don’t have enough β€œreputation” to post the image, so here is a link to what it currently looks like: http://imgur.com/c7mrjfV

+4
source share
1

a 100%, .

, .

CSS

.modal-list > li > a {
  color:#333;
  text-decoration: none;
  list-style: none;
  display: block;
  text-align: left;

  width: 100%;
  text-align: center;
}  
0

Source: https://habr.com/ru/post/1533074/


All Articles