使用 CSS 实现换行并换行
cssweb developmentfront end technology更新于 2024/3/12 13:32:17
使用 word-wrap 属性实现换行并换行。您可以尝试运行以下代码,在 CSS 中实现 word-wrap 属性
示例
<!DOCTYPE html>
<html>
<head>
<style>
div {
width: 200px;
border: 2px solid #000000;
}
div.b {
word-wrap: break-word;
}
</style>
</head>
<body>
<h2>word-wrap: break-word property</h2>
<div class = "b"> ThisisdemotextThisisdemotext:
thisisaveryveryveryveryveryverylongword.
The long word wraps to the next line.</div>
</body>
</html>
输出

相关文章
有用资源
css 参考教程 - 该教程包含有关 css 的更多信息:https://www.cainiaomax.com/css/

