Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用html和css更改文本在屏幕上的显示方式_Html_Css_Formatting - Fatal编程技术网

使用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;
}