Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is <br> an element, not an entity? [duplicate]

Possible Duplicate:
Why is <br> an HTML element rather than an HTML entity?

Why is a line break in HTML an element <br> instead of an entity, such as &br;? In many ways it seems a bad fit to be an element (e.g. has a different node type attribute to normal HTML elements, is similar to &nbsp; in what it does).

like image 579
wheresrhys Avatar asked Feb 06 '12 02:02

wheresrhys


1 Answers

Whitespace in HTML is rendered as a one character space regardless of the amount of whitespace. This assists in markup authorship without impacting the markup rendering.

<br/> is not a display character, but a formatting specifier for when the format affects the content's meaning. The HTML 5 spec states that it "must be used only for line breaks that are actually part of the content, as in poems or addresses."

like image 72
JeremiahLee Avatar answered Oct 16 '22 11:10

JeremiahLee