CSS 分词和自动换行不起作用

ape*_*oko 1 html css datatables bootstrap-4

我可以寻求帮助吗,自动换行或断字对我的字符串不起作用,

文本如下:过去五年,该公司的收入一直在增长,2015 年至 2019 年间总体增长了 49%。截至 2019 年 12 月 29 日的年度收入增长了 7%,达到 4.264 亿美元,而 2019 年的收入为 3.982 亿美元。截至2018年12月30日止的年度。这一增长主要是由于截至2018年12月30日止的年度期间及之后开设的新餐厅带来的额外359个营业周带来的2,850万美元的增量收入以及可比餐厅的增长推动的销售量。截至 2019 年 12 月 29 日止年度,净利润增加 70 万美元,达到 620 万美元,较 2018 年同期的 550 万美元增加 12%。这是由于折旧和摊销成本增加,以及所得税优惠。2019年末公司现金等价物总计1010万美元,比上年增加200万美元。运营活动产生 4,340 万美元,而投资活动则使用 3,330 万美元。融资活动另外使用了 830 万美元,主要用于普通股回购和信用额度支付。

这是我的 CSS

.txt {
  word-break: break-all;
  word-wrap: break-word;
  min-height:150px;
  max-width:150px;
  overflow-x: auto;
}
Run Code Online (Sandbox Code Playgroud)

这是我的 HTML

<td>
   <div class="txt">{{ $value }}</div>
</td>
Run Code Online (Sandbox Code Playgroud)

发生的情况是

在此输入图像描述

字符串不会破坏它显示在一行中,即使溢出是否隐藏,

Raf*_*lon 5

它似乎工作正常:

.txt {
  word-break: break-all;
  word-wrap: break-word;
  min-height:150px;
  max-width:150px;
  overflow-x: auto;
}
Run Code Online (Sandbox Code Playgroud)
<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>
Run Code Online (Sandbox Code Playgroud)

你有没有“检查”你的 div 看看是否有其他 css 规则弄乱了事情?

在此输入图像描述

当您在浏览器中点击F12,然后div通过单击选择您的其中一个(1 或 2)时,您将看到在 3 中应用了哪些样式。您
可能会看到word-break: break-all;或 与 相同,word-wrap因为它被其他一些覆盖规则。