Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQueryMobile ListView Text Wrap

In jQueryMobile, listviews truncate text. There are lot of articles and posts like this one that say to add white-space:normal in css.

However, this isn't working for me in jQueryMobile 1.4. You can see here. To test you'll need to shrink your browser window size. Any ideas?

like image 540
Tim Hoolihan Avatar asked Nov 30 '22 19:11

Tim Hoolihan


2 Answers

Given your LI markup:

<li>
  <a href="#">
    <img src="http://pbs.twimg.com/profile_images/1225696765/29072010042_normal.jpg" />
    <h3 class="wrap">Marco Alberto Sotelo (@marcosotelo79)</h3>
    <p>Sun Feb 02 20:01:24 +0000 2014</p>
    <p class="wrap">Ya estamis en el estadio MetLife para el @SuperBowl #SBUniversal http://t.co/80 /1wSo5O9E</p>
    <br />
    <img src="http://pbs.twimg.com/media/Bffo-1MCIAEoY5X.jpg" style="max-width: 90%; margin: auto;" />
  </a>
</li>

Change the class wrap to:

.wrap {
    white-space: normal !important;
}

The !important allows the class to override all the jQM classes that are setting it to nowrap.

Here is a DEMO

like image 151
ezanker Avatar answered Dec 04 '22 11:12

ezanker


try this

<li><p class='ui-li-desc'>Text to be displayed</p></li>
like image 24
ajitksharma Avatar answered Dec 04 '22 11:12

ajitksharma