使用html和css更改文本在屏幕上的显示方式
我正在建立一个简单的博客网站,需要帮助格式化提交到网站首页的帖子。您有很多选择。简单的方法是将文本放入使用html和css更改文本在屏幕上的显示方式,html,css,formatting,Html,Css,Formatting,我正在建立一个简单的博客网站,需要帮助格式化提交到网站首页的帖子。您有很多选择。简单的方法是将文本放入标记中,并根据需要为div指定宽度 <div style="width:100px">"Hello, this is my first post. As you can see, it wraps all the way around the text box and into another line."</div> “您好,这是我的第一篇文章。正如您所看到的,它环绕
标记中,并根据需要为div
指定宽度
<div style="width:100px">"Hello, this is my first post. As you can see, it wraps all the way around the text box and into another line."</div>
“您好,这是我的第一篇文章。正如您所看到的,它环绕着文本框,并进入另一行。”
您可以通过多种方式实现这一点。也许最简单的方法是把你的文本放在一个容器里,并给它一个宽度。文本将自动换行
<div class="text">Your text here</div>
您应该添加一个word wrap css属性,并将其设置为断开word。这将强制文本在容器中换行
.container {
word-wrap: break-word;
}
.container {
word-wrap: break-word;
}