HTML换行到下一行?

标签 html css

我有一个包含以下内容的 div

hai hello ho
w are you wh
ere are you?

但我希望单词出现在下一行,而不是像下面这样中断。

hai hello 
how are you 
where are 
you?

我需要应用什么CSS样式?

谢谢!

最佳答案

您可以使用以下抄送:

.wrap {
    word-wrap: break-word;
    width: 100px;
}

使用以下 html:

<div class="wrap"> 
    hai hello how are you where are you?
</div>

关于HTML换行到下一行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29677447/

相关文章:

html - 如何让图片元素越过导航栏元素

javascript - 使用 Javascript 生成的内容会忽略 CSS 类吗?

javascript - 水平滚动不适用于 iPhone

html - 如何使用 CSS 制作成 Angular 工具提示指针元素?

c# - 如何划分 3 个 div(CSS + MVC)

html - 如何在使用 bootstrap css 文件时模糊文本的背景?

javascript - 使用 JavaScript 填充多个 DIV

html - 如何仅使用 CSS 设置某个 Angular 的边框半径

javascript - 在 html 中使用表单的 React 方式,提交操作与 ajax 请求一起发生

html - 为什么带有position:absolute的元素放在::after伪元素后面