Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is my header text being truncated?

I have a page built with jQuery mobile with header markup that looks like this:

<div data-role="header">
    <h1>The Magnet Puzzle</h1>
</div>

I tested it out in an Android and a Windows phone, and in both it truncates the last three characters of the header text, even though the header is wide enough to fit the entire title:

turncated header

I want it to look like this instead:

full header text

Why is it being truncated, and how can I fix it so that it displays the entire title?

like image 681
Peter Olson Avatar asked Jan 03 '12 20:01

Peter Olson


2 Answers

I think the real trouble is that JqMobile is setting the left and right margin to 30% leaving only 40% of the total width for your title. Change that to 10% and you get the ellipsis when you really need it.

.ui-header .ui-title {
    margin-right: 10%;
    margin-left: 10%;
}
like image 197
bvs Avatar answered Oct 17 '22 10:10

bvs


It's being truncated because of jQuery Mobile's CSS for .ui-header .ui-title, which sets the overflow to hidden, the white-space to nowrap and the text-overflow to ellipsis.

I'm not sure if there is a better way to do this, but you can override the jQuery mobile CSS like so:

.ui-header .ui-title {
  overflow: visible !important;
  white-space: normal !important;
}

This question has been asked before with the same answer.

like image 32
Ivan Avatar answered Oct 17 '22 10:10

Ivan