Hey guys, using a dynamic div here to spit out definitions based on final dispositions of records.

I have a database that contains all dispositions and the definitions of each disposition.

I want to break after so many characters, so i use the php wordwrap() function but get an odd result.

Call Back Later:

Representative was unable to reach patient. PRSM
will
attempt to re-contact.

It breaks right on the first line, then puts one word on the second line and breaks again putting the rest on the third line.

I have tried

wordwrap($desc, 60,  "<br />\n")

AND

wordwrap($desc, 60,  "\n")

AND

wordwrap($desc, 60,  "<br />")

AND

wordwrap($desc, 60,  "\n<br />")

I've checked the database for any newlines in the data and there are none.

Does anyone have any ideas or suggestions?

whats the style settings on your dynamic div?

.definition {
    border:2px dotted #FC5B00;
    width:250px;
    position:absolute;
    right:5;
    top:25;
  }
  
  .definition h4 {
    background:#4D72B6;
    color:white;
    padding:5px;
    margin-top:0px;
    padding-top:0px;
    margin-bottom:0px;
    padding-bottom:0px;
    -moz-border-radius-topright:5px;
    -moz-border-radius-topleft:5px;
    -webkit-border-top-right-radius:5px;
    -webkit-border-top-left-radius:5px;
    border-top-left-radius:5px;
    border-top-right-radius:5px;
  }
  
  .definition p {
    color:#333;
    padding:10px;
    font-size:9px;
    margin-top:2px;
    padding-top:2px;
    margin-bottom:2px;
    padding-bottom:2px;
  }

The definition is inside the <p> tag.

have you tried increasing the 250px width?

It sounds awful close to making it wrap.

Better code for me to test would be the html of the dynamic div with the wrapped text example, i usually handle wrapping in css using:

div{
overflow:hidden;
white-space:nowrap;
}

the html making it wrap is the only explanation i can think of

to check if it wordrap or a css problem

echo"<XMP>";
var_dump($wrapedTxt);
echo"</XMP>";

this will display the <br /> in the $wrapedTxt