aspose file tools*
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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
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: 10535
    
    9

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?


[How to ask questions] [Donate a pint, save a life!] [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: 15376
    
    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: 10535
    
    9

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://aspose.com/file-tools
 
subject: Word wrapping long text without whitespaces