【问题标题】:hot to make the text move to next line inside div when it covers the width of the div in css当文本覆盖css中div的宽度时,使文本移动到div内的下一行
【发布时间】:2010-11-18 19:49:15
【问题描述】:

嗨,如果文本覆盖了 contenteditable="true" 的宽度,我如何使 div 中的文本进入下一行

就像 gmail 聊天,当有人在 div 中写入任何内容时,它会自动移至下一行

我说的 contentEditable="true" div 是指我们可以在其中编辑或写入文本的 div。

【问题讨论】:

  • 固定宽度的 div 应该已经这样做了。
  • 请再次阅读我编辑的问题。
  • contentEditable 只是 HTML5 不是,应该有一个 'html5' 标签。我相信如果宽度受到父母或自身宽度声明的限制,它确实可以正确包装。

标签: css html


【解决方案1】:
.break-word { 
word-wrap: break-word;
}

【讨论】:

    【解决方案2】:

    有时使用“word-wrap : break-word”是不够的。

    .break-word { 
      word-wrap: break-word;
      display:flex;
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-08-27
      • 1970-01-01
      • 2012-09-15
      • 1970-01-01
      • 2016-11-12
      • 2014-11-28
      • 2013-05-18
      • 1970-01-01
      相关资源
      最近更新 更多