-3

I am facing a problem in word-wrapping the text in using the suggested word-wrap:break-word style, as it is not replicated in FF and others,

I have also refered the below Question as it is the same as mine, but didnt found it helpful in any way

Old Question

So can any body help me up to achieve this?

Thanks

4
  • 1
    What exactly did you find not helpful in the other question? Commented Dec 6, 2011 at 10:17
  • 1
    "I have also refered the below Question as it is the same as mine, but didnt found it helpful in any way" Perhaps, like the author of that question, you could say why you didn't find the techniques discussed there helpful, particularly the one described in the most up-voted answer. Commented Dec 6, 2011 at 10:19
  • @T.J. Crowder Being Most upvoted is not the best We need always. Finally it should work, and it is not working i.e. word-wrap:break-word style Commented Dec 6, 2011 at 10:22
  • 1
    @OMTheEternity: Until/unless you quote your markup and styling, describe the result you expect, and describe what you're seeing instead (e.g., Asking Technical Questions 101), your question cannot be answered. Commented Dec 6, 2011 at 10:29

2 Answers 2

3

word-wrap:break-word is supported in Firefox, from version 3.5 onwards, Opera from 10.5, Safari from 2, Chrome from 1, and IE from at least 6. See:

Failing that, I’ve sometimes resorted to inserting a content-less <span> with display:inline-block in the places where I want the string to break. That works in Firefox 3.0, although not in earlier versions of Firefox because they don’t support display:inline-block.

Sign up to request clarification or add additional context in comments.

5 Comments

@OMTheEternity: What is the result you're seeing that makes you think it isn't working?
@OMTheEternity: I tried it too, and word-wrap:break-word is supported in the browsers I’ve stated. See jsfiddle.net/fBMdy. Maybe you could post the code showing what you’re trying to wrap?
@OMTheEternity: Paul's not the only one who thinks it works: caniuse.com/#search=word-wrap Here's a more thorough example: jsbin.com/arodil
Thanks Paul and T. J. Crowder, It worked but by the way Pieter Told me so.
@OMTheEternity: it’d be nice to know what wasn’t working in the first place, but I’m glad you got your issue solved.
2

If you specify the desired width and set height: auto; you should get the desired line-wrapping in all modern browsers.

EDIT: white-space: normal; wasn't really necessary, and I should note that the solution wraps lines, not individual words.

7 Comments

How does that cause breaking within words when necessary? I'm not getting it: jsbin.com/arodil
It worked for me, but how did setting width and height: auto; white-space: normal; supported it?
Pieter, did you mean those styles in addition to word-wrap: break-word;?
I don't believe this would support breaking inside words. Just breaking lines.
@Pieter: out of interest, why do you have to set white-space: normal? Isn’t that the default value?
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.