| 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
|
|
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.
|
 |
 |
|
|
subject: Word wrapping long text without whitespaces
|
|
|