search

Home  >  Q&A  >  body text

How to make space between 2 divs in Ionic

I need space at the top and bottom of the image so it will be centered and the ion-col will be down.

<ion-content [fullscreen]="true" class="bg-class" text-center>

  <ion-img src="assets/icon/moon_logo.png" style="width:80%; margin: auto;">
  </ion-img>

  <ion-col>
    <div style=" margin: auto; padding-bottom: 15px;">
      <ion-button expand="block" style="--background:white; color: #1B0B50;">Login</ion-button>
    </div>
    <div style="margin: auto;">
      <ion-button expand="block">Get Started</ion-button>
    </div>
    <ion-row style="justify-content: center;">
      <p style="color: #576898; font-size: 12px;">Privacy Policy</p>

      <p style="color: #576898; font-size: 12px; padding-left: 20px;">Terms Of Use</p>
    </ion-row>
  </ion-col>

</ion-content>

Expected display results

P粉203792468P粉203792468282 days ago322

reply all(1)I'll reply

  • P粉883278265

    P粉8832782652024-02-18 11:58:41

    First, use ion-col in ion-row and ion-row in ion-grid, otherwise you will see unexpected results. There are many solutions now, one is to use flex and flex-grow:

    
      
    ...

    reply
    0
  • Cancelreply