简体   繁体   中英

How to align ionic HTML elements horizontally

i have these ionic HTML elements:

<ion-card-content>

<b style="font-size: 18px;"  class="ion-float-left">Mes Jolts</b>  
<ion-img src="./assets/images/jolt-coin.svg" style="height:20pt;width:20pt;" class="ion-float-right"></ion-img>        
 <b style="font-size: 35pt; color:var(--ion-color-primary); margin-right:5%;"  class="ion-float-right">53</b>                                               

 </ion-card-content>

i want to get these elements horizontally aligned in the same line, this is what this code results in: 在此处输入图像描述

Use flexbox for your main element

<ion-card-content  style="width: 100% ;display: flex; justify-content: space-between; align-items: center">

<b style="font-size: 18px;"  class="ion-float-left">Mes Jolts</b>  

<div>
  <ion-img src="./assets/images/jolt-coin.svg" style="height:20pt;width:20pt;" 
  class="ion-float-right"></ion-img>        
  <b style="font-size: 35pt; color:var(--ion-color-primary); margin-right:5%;"  
  class="ion-float-right">53</b>                                               
</div>
 </ion-card-content>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM