我有一个要求。

关键:这就是价值
type:这是类型值

我使用<pre>标记,使用后显示类似

key1 :this is the value
          type1 : this is the type value

          key2 :this is the value
          type2 : this is the type value

key2 :this is the value
          type2 : this is the type value


我的要求是到下一个键,类型应该从头开始

key1 :this is the value
type1 : this is the type value

key2 :this is the value
type2 : this is the type value

最佳答案

应用此CSS类。

CSS:

pre { white-space:pre-line;}


HTML:

<div>
    <pre>key1 :this is the value
        type1 : this is the type value

        key2 :this is the value
        type2 : this is the type value

        key2 :this is the value
        type2 : this is the type value</pre>
</div>


输出:

key1 :this is the value
type1 : this is the type value

key2 :this is the value
type2 : this is the type value

key2 :this is the value
type2 : this is the type value

07-24 09:43
查看更多