Best approach to break long strings?

Hi,

I’ve read a couple of things about how to handle long strings so they break to stay whithin their container.

What do you gurus do in such situations?

Regards,

-jj. :slight_smile:

The quick and dirty version: don’t have long strings. That’s the long clean version, too. Just exactly what are and from where cometh these long strings? If they are really integral pieces of the page’s content, the design process should have allowed for them.

Please show us some specimen content that contains overly long strings. I have no doubt that one or another of us will have a specific suggestion.

cheers,

gary

Originally an IE specific property but it is now a valid CSS3 property too.

word-wrap:break-word;

Should work for you with most all current browsers as well as legacy IE

Oops! I had forgot that, Ray. I am still curious why long strings would rear their heads without having been considered in the development of the text blocks that contain them. (?)

cheers,

gary

Yeah, worked like a charm.

Long string of characters such as whole font chars. Length can vary.

I’m running slow tonight. Can you clarify for me?

cheers,

gary

Oh sorry. If you want to display fonts you created, you may have long strings.

Anyway, word-wrap:break-word; does not work as expected in opera, which is looking for a white space to break…

So I’m back at square one.

It works fine in latest opera as far as I can tell. What is the exact structure that you are having trouble with ?


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style>
.test {
    word-wrap:break-word;
    width:300px;
    border:1px solid #000
}
</style>
</head>
<body>
<div class="test">jlkjllllllllpouo9uporpnlyfkdffvyhvbttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt</div>
</body>
</html>


Hello Paul,

Thanks for your reply. :slight_smile:

I upgraded Opera and the problem is now fixed.