【问题标题】:CSS: break long words without breaking small words Internet Explorer 11 in anchor elementCSS:在锚元素中打破长词而不打破小词 Internet Explorer 11
【发布时间】:2025-12-10 12:15:02
【问题描述】:

基本上我想做它所说的:How to break long words in the text without breaking short words 带有 锚元素的文本, 使用 Internet Explorer 11, 我已经尝试了很多组合:
word-break:break-all;
word-break: break-word;
word-wrap: break-word:
来自这个问题:
Internet Explorer 11 word wrap is not working
我知道我应该将white-space: pre-wrap 属性添加到我已经做过的代码中。不过,这对我不起作用。

这是 HTML 代码:

<div class="container">
  <table class="table">
    <tbody class="tBody">
      <tr>
        <td>
          <span>
             <img src="image.png">
              <a href="">This is a verrrrrrrrrrrrrrrrrrrrrrrrrrrrrrryyyyy long
                      text that doesnt work like I want it to. I hate IE.
              </a>
          </span>
         </td>
      </tr>
   </tbody>
  </table>
</div>

CSS:

.container {
  white-space: pre-wrap;
  display: inline-table;
  word-wrap: break-word; 
  word-break: break-all;
 }

【问题讨论】:

  • 你的 CSS 在哪里?

标签: html css internet-explorer-11


【解决方案1】:

我终于成功了,我将它添加到我的 CSS 文件中:

table,td,th, td *, td a, td img {
    word-wrap: break-word;
    word-break: break-all;
}

table {
    width:100%;
    table-layout:fixed;
}

【讨论】: