开发者

html code for single-line line break

开发者 https://www.devze.com 2023-01-18 20:51 出处:网络
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:

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 &l开发者_开发百科t;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


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.


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.


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 />.


Try this:

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

精彩评论

暂无评论...
验证码 换一张
取 消