Html显示格式化文本 [英] Html display formatted text

查看:146
本文介绍了Html显示格式化文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须在html页面上显示一堆文本。
文本看起来像这样:

  +  -  001这是一行00:12:04 
002 ----------------------------------
- 003 Everthing目前看起来不错 - ---

文本是预格式化的,包含大量的空格和破折号,每行都有相同的长度(所有的字符都有相同的宽度)。

有没有办法在html中显示文本而不会丢失格式?

$在< pre> 标签内包装你的文字。



JSFiddle

 < pre> 
+ -001这是一行00:12:04
002 ----------------------------- -----
- 003 Everthing目前看起来不错------
< / pre>


I’ve to display a bunch of text on an html page. The text looks something like this:

+-001 This is a Line            00:12:04
  002 ----------------------------------
- 003 Everthing looks good so far ------ 

The text is "pre-formatted" and contains a lot of whit spaces and dashes and every line has the same length (all chars have the same width).

Is there a way to display the text in html without losing the format?

解决方案

Wrap your text inside the <pre> tag.

JSFiddle

<pre>
+-001 This is a Line            00:12:04
  002 ----------------------------------
- 003 Everthing looks good so far ------ 
</pre>

这篇关于Html显示格式化文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆