DevAra
DevAra

Reputation: 530

Styling issue text-center not working in ionic 5

If I simply add text-center inside ion-col element then it's not working. But if I add it with class attribute like class="ion-text-center" then it's working.I'm using ionic 5.0.0 version.

Here is the code not working for me

 <ion-grid>
<ion-row>
  <ion-col text-center>
    <h3>text-center</h3>
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed ac vehicula lorem.
    <div class="ion-text-center">
    </div>
  </ion-col>
 </ion-row>

hers is the code with class attribute, it's working

 <ion-grid>
    <ion-row>
      <ion-col class="ion-text-center">
        <h3>text-center</h3>
        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed ac vehicula lorem.
        <div class="ion-text-center">
        </div>
      </ion-col>
     </ion-row>
  </ion-grid>

What can be the issue?

Upvotes: 0

Views: 820

Answers (1)

Shakeeb Ahmad
Shakeeb Ahmad

Reputation: 42

There's no issue. Properties like text-center are deprecated since ionic 4, and you are supposed to use class='ion-text-center' etc. for the same.

The browser console would've shown you the deprecation-warning on ionic serve.

Upvotes: 1

Related Questions