62

Typically we all using HTML numbers or names in web pages. For example, & is & or &, and $, @, ©, ®, etc.

Is there an HTML number or name for <br>?.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Antony SUTHAKAR J
  • 912
  • 1
  • 7
  • 13

6 Answers6

72

& is a character; &amp; is a HTML character entity for that character.

<br> is an element. Elements don't get character entities.

In contrast to many answers here, \n or &#13; are not equivalent to <br>. The former denotes a line break in text documents. The latter is intended to denote a line break in HTML documents and is doing that by virtue of its default CSS:

br:before { content: "\A"; white-space: pre-line }

A textual line break can be rendered as an HTML line break or can be treated as whitespace, depending on the CSS white-space property.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Amadan
  • 191,408
  • 23
  • 240
  • 301
  • Thanks @Amadan. But if I want to break a sentence after a particular word then
    only useful. If not what else can do this like what
    do?. :before can use only to break from the beginning of the sentence. Am I right?
    – Antony SUTHAKAR J Nov 25 '15 at 08:14
  • 1
    For example I can say, text inside the title attribute. – Antony SUTHAKAR J Nov 25 '15 at 08:15
  • 2
    Sorry, I do not understand what you are asking. The `br:before....` was an explanation why `
    ` breaks the line in HTML, and `\n` does not necessarily do so. A rough guideline is, in HTML, use `
    ` for breaking the line always, except inside `
    ` and `
    – Amadan Nov 25 '15 at 08:16
25

You may be looking for the special HTML character, &#10; .

You can use this to get a line break, and it can be inserted immediately following the last character in the current line. One place this is especially useful is if you want to include multiple lines in a list within a title or alt label.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Rob Avery
  • 259
  • 3
  • 2
9

<br> is an HTML element. There isn't any ASCII code for it.

But, for line break sometimes &#013; is used as the text code.

Or &lt;br&gt;

You can check the text code here.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
ketan
  • 19,129
  • 42
  • 60
  • 98
6

No, there isn't.

<br> is an HTML ELEMENT. It can't be replaced by a text node or part of a text node.

You can create a new-line effect using CR/LF inside a <pre> element like below:

<pre>Line 1
Line 2</pre>

But this is not the same as a <br>.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Amit
  • 45,440
  • 9
  • 78
  • 110
4

In HTML, the <br/> tag breaks the line. So, there's no sense to use an ASCII character for it.

In CSS we can use \A for line break:

.selector::after{
   content: '\A';
}

But if you want to display <br> in the HTML as text then you can use:

&lt;br&gt; // &lt denotes to < sign and &gt denotes to > sign
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Bhojendra Rauniyar
  • 83,432
  • 35
  • 168
  • 231
-4

To break to the new line you can use &#13;

  • This is incorrect. See the other answers for more information. – Tim Dec 30 '16 at 18:01
  • 1
    This does not provide an answer to the question. Once you have sufficient [reputation](http://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](http://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](http://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/low-quality-posts/14745086) – Vasim Shaikh Dec 30 '16 at 18:48
  • 6
    @VasimVanzara This *is* an attempted answer to the question. If you feel it is not a *correct* answer then you're free to cast a downvote accordingly, but answers do not merit deletion just because you think they're wrong, nor should an answer be posted as a comment just because you think it's wrong. – Servy Dec 30 '16 at 20:55
  • Please use Markdown's inline-code to display ` ` instead of asking people to complete your answer. – Nato Boram Nov 06 '21 at 01:54