文字没有显示它应该在html中

时间:2014-10-06 15:42:28

标签: javascript jquery html css

我有一段看起来像这样的文字:

<p> We recently reduced the number of savings accounts we offer. I welcomed this because I think
 members find it confusing to look through tables of lots of slightly different accounts, all 
with advantages and disadvantages. I think it affects their trust in us. But I don’t understand 
why we haven’t applied this to children’s accounts of all things. Since children don’t pay tax, 
why do they need an ISA as well as a children’s savings account? Children (and their parents) 
are the last people we want to confuse as they could be customers for life. And why is our 
children’s savings account called the ‘Smart Limited Access’? It doesn’t strike me as being very 
self-explanatory or child friendly. How about just ‘Nationwide Young Saver Account’?

I’d be grateful if you could clear this up for me.

Best regards,

Vanessa</p>

然而,当它被放入html时,它会忽略这个布局,并且它有一行。如何将其保留为原始文本

5 个答案:

答案 0 :(得分:3)

使用<pre>代替{{h1}}代码来保持格式不变。

<p>

答案 1 :(得分:0)

将每一行放在单独的<p>标记中。

<p>We recently reduced ... 'Nationwide Young Saver Account'?</p>
<p>I'd be grateful if you could clear this up for me</p>
<p>Best regards,</p>
<p>Vanessa</p>

答案 2 :(得分:0)

一种干净的方法是设置p标记

的css属性
<p class="makeItLookTheSame"> We recently reduced the number of savings accounts we offer. I welcomed this because I think
 members find it confusing to look through tables of lots of slightly different accounts, all 
with advantages and disadvantages. I think it affects their trust in us. But I don’t understand 
why we haven’t applied this to children’s accounts of all things. Since children don’t pay tax, 
why do they need an ISA as well as a children’s savings account? Children (and their parents) 
are the last people we want to confuse as they could be customers for life. And why is our 
children’s savings account called the ‘Smart Limited Access’? It doesn’t strike me as being very 
self-explanatory or child friendly. How about just ‘Nationwide Young Saver Account’?

I’d be grateful if you could clear this up for me.

Best regards,

Vanessa</p>

在你的css文件中如此:

.makeItLookTheSame{
    white-space: pre-wrap;
    word-wrap: break-word;
}

答案 3 :(得分:0)

<p> We recently reduced the number of savings accounts we offer. I welcomed this because I think
 members find it confusing to look through tables of lots of slightly different accounts, all 
with advantages and disadvantages. I think it affects their trust in us. But I don’t understand 
why we haven’t applied this to children’s accounts of all things. Since children don’t pay tax, 
why do they need an ISA as well as a children’s savings account? Children (and their parents) 
are the last people we want to confuse as they could be customers for life. And why is our 
children’s savings account called the ‘Smart Limited Access’? It doesn’t strike me as being very 
self-explanatory or child friendly. How about just ‘Nationwide Young Saver Account’?</p>

<p>I’d be grateful if you could clear this up for me.</p>

<p>Best regards,<br>

Vanessa</p>

答案 4 :(得分:0)

您的HTML文件:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" /> 
        <meta name="description" 
              content="" />
        <title></title>
        <link rel="stylesheet" href="style.css" />
        <link rel="icon" type="image/png" href="" />
    </head>


 <body>

  <div id="yourText">
     Say something here
  </div>

 </body>
 </html>

在同一文件夹中创建一个名为style.css的文件 插入此内容:

#yourText
{
width: 400px;
border: 1px solid black;
}

您必须在句子的每一端设置<br />并调整宽度(400) 删除边框,这样就可以了解它是如何工作的