Mozilla Firefox solution
Add:
display: inline-block;
to the style of your td.
Webkit based browsers (Google Chrome, Safari, ...) solution
Add:
display: inline-block;
word-break: break-word;
to the style of your td.
Note:
Mind that, as for now, break-word is not part of the standard specification for webkit; therefore, you might be interested in employing the break-all instead. This alternative value provides a undoubtedly drastic solution; however, it conforms to the standard.
Opera solution
Add:
display: inline-block;
word-break: break-word;
to the style of your td.
The previous paragraph applies to Opera in a similar way.
Answer from Stencil on Stack OverflowMozilla Firefox solution
Add:
display: inline-block;
to the style of your td.
Webkit based browsers (Google Chrome, Safari, ...) solution
Add:
display: inline-block;
word-break: break-word;
to the style of your td.
Note:
Mind that, as for now, break-word is not part of the standard specification for webkit; therefore, you might be interested in employing the break-all instead. This alternative value provides a undoubtedly drastic solution; however, it conforms to the standard.
Opera solution
Add:
display: inline-block;
word-break: break-word;
to the style of your td.
The previous paragraph applies to Opera in a similar way.
Word-Break has nothing to do with inline-block.
Make sure you specify width and notice if there are any overriding attributes in parent nodes. Make sure there is not white-space: nowrap.
see this codepen
<html>
<head>
</head>
<body>
<style scoped>
.parent {
width: 100vw;
}
p {
border: 1px dashed black;
padding: 1em;
font-size: calc(0.6vw + 0.6em);
direction: ltr;
width: 30vw;
margin:auto;
text-align:justify;
word-break: break-word;
white-space: pre-line;
overflow-wrap: break-word;
-ms-word-break: break-word;
word-break: break-word;
-ms-hyphens: auto;
-moz-hyphens: auto;
-webkit-hyphens: auto;
hyphens: auto;
}
}
</style>
<div class="parent">
<p>
Note: Mind that, as for now, break-word is not part of the standard specification for webkit; therefore, you might be interested in employing the break-all instead. This alternative value provides a undoubtedly drastic solution; however, it conforms to
the standard.
</p>
</div>
</body>
</html>
html - Why doesn't word-wrap work properly in CSS3? - Stack Overflow
html - css word-wrap: break-word won't work - Stack Overflow
"overflow-wrap: break-word" not working in table
Please break titles on words, not letters - Meta Stack Overflow
If word-wrap: break-all don't work, try also add this:
white-space:normal;
work for me with the .btn class in Bootstrap 3
Use word-break: break-all;
#fos { font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size:14px;
font-weight: normal;
line-height: 18px;
width: 238px;
height:38px;
cursor: pointer;
word-break: break-all;
border:2px solid; }
LIVE DEMO
white-space: nowrap will prevent word-break from taking effect. Some templates apply white-space: nowrap which necessitates overriding this attribute with white-space: normal.
To properly break long-words it requires to combine several CSS properties, I would suggest defining and applying helper class like this:
.break-long-words {
overflow-wrap: break-word;
word-wrap: break-word;
word-break: break-all;
word-break: break-word;
hyphens: auto;
}
Properties explained:
- overflow-wrap and word-wrap are aliases for same thing but some browsers support one and not the other so we need them both. They are offical "correct" way to break words but they don't have any effect on elements with dynamic width so we need more...
- word-break is originally intended for requiring a particular behaviour with CJK (Chinese, Japanese, and Korean) text but works similar to word-wrap but in WebKit break-all value breaks everything and everywhere. For that reason we must use non-standard and poorly documented WebKit-only break-word value.
- and optionally, if it makes sense for break words to have hypens (ie. for URLs it probably doesn't) we can use hypens in browsers that support them (at the moment Firefox, Safari, Edge and IE 10+). Also note that in Firefox hypens don't work if you have word-brake property so unless you have fixed-width container you must choose between hypens on FF or legacy support.
Note that I omitted vendor prefixes but if you don't use something like Autoprefixer than this is full verison:
.break-long-words {
overflow-wrap: break-word;
word-wrap: break-word;
-ms-word-break: break-all;
word-break: break-all;
word-break: break-word;
-ms-hyphens: auto;
-moz-hyphens: auto;
-webkit-hyphens: auto;
hyphens: auto;
}
This should be fixed in the next build. Thanks for reporting!
The proper solution to this, noted at https://stackoverflow.com/a/18628052/1709587, is not to simply remove word-break: break-all but rather to replace it with overflow-wrap: break-word, whose behaviour, per MDN is:
To prevent overflow, normally unbreakable words may be broken at arbitrary points if there are no otherwise acceptable break points in the line.
This will cause browsers to wrap at word breaks where possible, but will prevent titlesdeliberatelycraftedtocontainsingleverylongwordswithnospaceslikethisobnoxiousfuckerimcreatingherethatiswiderthanthepost from breaking the site's layout. Indeed, I'd think that word-break: break-all probably shouldn't be used anywhere in Stack Exchange's codebase, and would suggest that they audit the codebase for any occurrence of it and replace each of them with overflow-wrap: break-word unless there's some really good reason not to.
They still get this right within post bodies, as I've demonstrated above, so I'm not sure how they managed to break it in titles.
It seems to work fine:
.txt {
word-break: break-all;
word-wrap: break-word;
min-height:150px;
max-width:150px;
overflow-x: auto;
}
<div class="txt">
The company's revenue has been increasing for the last five years with an overall growth of 49% between 2015 and 2019. Revenue increased 7% to $426.4 million for the year ended December 29, 2019, as compared to $398.2 million for the year ended December 30, 2018. The increase was primarily driven by $28.5 million in incremental revenue from an additional 359 operating weeks provided by new restaurants opened during and subsequent to the year ended December 30, 2018 as well as an increase in its comparable restaurant sales. Net income increased by $0.7 million and 12% to $6.2 million for the year ended December 29, 2019 as compared to $5.5 million during the comparable period in 2018. This was due to the increase in depreciation and amortization costs, as well as the increase in income tax benefits. The company's cash equivalents at the end of 2019 totaled $10.1 million, an increase of $2 million from the previous year. Operating activities generated $43.4 million, while investing activities used $33.3 million. Financing activities used another $8.3 million primarily for common stock repurchases and line of credit payments.
</div>
Did you "inspect" your div to see if some other css rule is messing the thing?

When you hit F12 in your browser and then select your div either by clicking on it (1 or 2), you'll see what styles are applied to it in 3.
You'll likely see word-break: break-all; or the same with word-wrap because it is overriden by some other rule.
you can do this instead of nesting div into td
.txt {
word-break: break-all;
word-wrap: break-word;
min-height:150px;
max-width:150px;
}
<table>
<tr>
<td class="txt">skdjfhskadjfhsdlkajfhdsakljfhsdakjfhslkadjfhsdalkjfhsadlkjfhsdalkjfhsadlkjfhsdakljfhsdalkjfhsadlkjfhsdalkjfhsladkjfhslakjfhlskadjfh</td>
<tr>
</table>
There are other questions about this subject, for instance this one with many excellent answers, but that amount of info may distract from the basic question, what do the different values to word-break do. So here's an answer to that question and that question only.
If you take this snippet
body {
max-width: 15em;
box-shadow: green 0 0 8px;
word-break: normal;
}
Some short words, somewhatlongerwords and extremelylongwordsthatarereallylong for testing purposes.
With the default value of normal, words are not broken; ordinary word wrap is used and the longest word overflows out of the box. Screenshot:

break-all breaks all words at the end of the line, no matter if they would fit in their entirety on the next line or not.

keep-all is meant for CJK (Chinese, Japanese and Korean) words, which ordinarily don't have spaces between them.
With pure English text, there's no difference to normal.

(If you're interested, this MDN article features an example with Japanese text, where you can see the difference.)
And break-word breaks up those words that don't fit in the box. This is not the same as break-all, which breaks all words regardless.

Now this last one is non-standard, and it doesn't work in all browsers, so if you want this, you should also write overflow-wrap: break-word; in your stylesheet, and for compatibility with older browsers word-wrap: break-word; as well.
There is more to it, but I'll refer you to this question for the reasoning, the history, etc.
Word break - breaks the word to the next line if it exceeds the width. You can check the css works in the browser or not in the below site.
caniuse.com
Update :
Safari now supports keep-all as a value. As of Safari 9.
word-break property is partially supported in Safari, i.e it only supports word-break if you use break-all as a value and not keep-all...
As you can see here (Read the note at very bottom) which says
Note: Partial support refers to supporting the "break-all" value, but not the "keep-all" value.
Bug Report 43917 - CSS3 'word-break: keep-all' is not supported
I have found this to work:
selector{ -webkit-hyphens: none;}