Please excuse this newbie question. I have some text pulled from an area and when displayed on the phone it longer than the screen size an continues off screen. I would like to do a simple text-wrapping which is usually no problem using CSS, but somehow it doesn’t work here - can you help me?
I made my own css class, and referenced it after ionic.css. The following will cause text to wrap on ion-items
.item.wrap, .item-content.wrap {
white-space: normal;
}
so, like
<ion-item class="wrap">
{{textThatMayBeTooLong}}
</ion-item>
Thank you so much for this! best regards, Jeppe
That didn’t work for me
use Ionic’s predefined style
<ion-item class="item-text-wrap">
{{textThatMayBeTooLong}}
</ion-item>
HTH
hey it worked for me
Hi,
I’m trying to use that class into a card header and it doesn’t work for me. This is the fragment of code that I’m using into the card-header.
<ion-item class="item-text-wrap">
<h5>{{promotion.description}}</h5>
</ion-item>
Do you know why?.
Thx
Works for me !! thanks
even it was not working for me…
<div class="card">
<div class="item">
<h2>NOTIFICATIONS & ALERTS</h2>
</div>
<div class="item item-body">
<ion-item class="item-text-wrap" ng-repeat="notification in vm.notifications">
{{notification.ArisNotificationMessage}}
</ion-item>
</div>
</div>
In Ionic 2, use the text-wrap attribute to work like a charm.
<ion-item text-wrap>
text here wraps to multiple lines
</ion-item>
Hey this work for me thank
You have to use CSS shape property for that.
best to use utility attributes.
this is a part of the docs you should check out:
Thanks this really works for in Ionic 3