title: Align center single or multiple image or div as a whole using Laravel and Css
body: <p>So I am trying to align flags and their respective tooltips. I tried loads of methods I knew but none seem to get results I am looking for.</p>
  
  <p>Below you can see a quick snapshot of what I am doing, I can have multiple or single flags for each user as shown and when hovered over a flag tooltip shows the language with respect to the flag.</p>
  
  <p>I would like to align center all the flags with their respective tooltips. But because I am coding in laravel php framework the divs are generated automatically.</p>
  
  <p><a href="https://i.stack.imgur.com/rfPnC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rfPnC.png" alt="snapshot of either single or multiple flags"></a></p>
  
  <p>below is my code for Laravel and divs</p>
  
  <pre><code>&lt;div class="w3-card-12" style="border-radius:15px; padding-left: 10%; width:200px; padding-top: 20px;
     padding-bottom: 30px;
     background-color: #FFA534;"&gt;
     &lt;img align="center" src="{{$user-&gt;photo}}" style=" border-radius:50%; ; border-style: solid; border-color: #333; border-width: 5px;" width="150px !important" height="150px !important" /&gt;
     &lt;h3 style="color:#000;     padding-right: 15%;
        padding-top: 20px;" align="center"&gt;{{$user-&gt;firstname}}&lt;/br&gt;{{$user-&gt;lastname}}&lt;/h3&gt;
     @foreach($offerings as $offering)
     @if($offering-&gt;user_id === $user-&gt;id)
     &lt;div class="tooltip2"&gt;
        &lt;img  align="middle" src="{{$offering-&gt;flag}}"/&gt;
        &lt;span class="tooltiptext"&gt;{{$offering-&gt;language}}&lt;/span&gt;
     &lt;/div&gt;
     @endif
     @endforeach
  &lt;/div&gt;
  </code></pre>
  
  <p>html code that is generated from laravel foreach loop</p>
  
  <pre><code>&lt;div class="w3-card-12" style="border-radius:15px; padding-left: 10%; width:200px; padding-top: 20px;
     padding-bottom: 30px;
     background-color: #FFA534;"&gt;
     &lt;img align="center" src="/uploads/15.jpg" style=" border-radius:50%; ; border-style: solid; border-color: #333; border-width: 5px;" width="150px !important" height="150px !important"&gt;
     &lt;h3 style="color:#000;     padding-right: 15%;
        padding-top: 20px;" align="center"&gt;Leslie&lt;br&gt;Lee&lt;/h3&gt;
     &lt;div class="tooltip2" style="
        margin: 0 auto;
        "&gt;
        &lt;img align="middle" src="/flags/PK-32.png" style="
           "&gt;
        &lt;span class="tooltiptext"&gt;Urdu&lt;/span&gt;
     &lt;/div&gt;
     &lt;div class="tooltip2"&gt;
        &lt;img align="middle" src="/flags/CN-32.png"&gt;
        &lt;span class="tooltiptext"&gt;Chinese&lt;/span&gt;
     &lt;/div&gt;
     &lt;br&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>css code for the tooltip and div</p>
  
  <pre><code>.tooltip2 {
      position: relative;
      display: inline-block;
  }
  
  
  .tooltip2 .tooltiptext {
      visibility: hidden;
      width: 120px;
      background-color: black;
      color: #fff;
      text-align: center;
      border-radius: 6px;
      padding: 5px 0;
      position: absolute;
      z-index: 1;
      top: 150%;
      left: 50%;
      margin-left: -60px;
  }
  
  .tooltip2 .tooltiptext::after {
      content: "";
      position: absolute;
      bottom: 100%;
      left: 50%;
      margin-left: -5px;
      border-width: 5px;
      border-style: solid;
      border-color: transparent transparent black transparent;
  }
  
  .tooltip2:hover .tooltiptext {
      visibility: visible;
  }
  </code></pre>