tags:

views:

81

answers:

4

i would like to show this text in my html code:

<html>
Name 1 
Name 2
Managers
</html>

I tried to do this but then in the site it shows like this:

Name 1 Name 2 Managers.

If I put <p> on it, it will show like this:

<html>
<p>Name 1 </p>
<p> Name 2 </p>
<p> Managers </p>

The result is this:

Name 1

Name 2

Managers

Is there any code how to keep this single like?

Thanks

+8  A: 

Perhaps you are looking for the <br> tag.

Note that you can change the spacing provided by a <p> tag by using CSS properties like margin, padding, line-height, etc.

RedFilter
+1 for suggesting re-styling `<p>` tags as well as the obvious option of using `<br>` instead.
Spudley
+3  A: 

Use a line break <br>

<html>
Name 1<br>
Name 2<br>
Managers
</html>

From W3Schools.com:

In HTML the <br> tag has no end tag.
In XHTML the <br> tag must be properly closed, like this: <br />.

sshow
+4  A: 

Try this:

<html>
Name 1<br />
Name 2<br />
Managers<br />
</html>
davecoulter
+3  A: 

In addition to the <br/>, as others have pointed out, you can also enclose text content in the <pre></pre> tag, which will preserve all the whitespace.

Robusto
`+1` didn't even think of that one.
sshow