This week's giveaways are in the MongoDB and Jobs Discussion forums.
We're giving away four copies of Mongo DB Applied Patterns and 4 resume reviews from Five Year Itch and have the authors/reps on-line!
See this thread and this one for details.
The moose likes HTML, CSS and JavaScript and the fly likes Word wrapping long text without whitespaces Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Mongo DB Applied Patterns this week in the MongoDB forum
or a resume review from Five Year Itch in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "Word wrapping long text without whitespaces" Watch "Word wrapping long text without whitespaces" New topic
Author

Word wrapping long text without whitespaces

Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 8430

I have a scenario where some text can be quite long, without white spaces. What is the recommended CSS way to make sure it wraps properly?


[Donate a pint, save a life!] [How to ask questions] [Onff-turn it on!]
Koen Aerts
Ranch Hand

Joined: Feb 07, 2012
Posts: 344

Did you try to put the text in a fixed width element and use the word-wrap property?
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15357
    
    6
If the browser supports CSS3, you have word-wrap, it not, you are basically out of luck. You can also look into zero width space character.

Eric
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 8430

Thanks for the suggestions guys.

@Eric
I did try the zero width space character and it works fine. Problem was I had to write some code snippet which would insert the character after every n characters. I was wondering if there was a "better" CSS approach.

For now I have used the word-wrap as well as the zero width space character.

 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Word wrapping long text without whitespaces
 
Similar Threads
Form in Jsp
Passed JCP with 93%
Apply Unicode escapes?
Wrapping the output of a outputText embedded in a DataTable
converting int to long