|
|
|
|
|
by lelandbatey
4058 days ago
|
|
It is a really common thing for people to erroneously close void elements[0] that aren't supposed to have closing tags, or to give them contents when they can't have any. For example: <p> some paragraph </p>
<br></br>
<p> a second paragraph </p>
or: <p> some first paragraph </p>
<br><p> a second paragraph </p></br>
<p> a third thing </p>
Neither of those are valid, and the last one is interpreted as: <p> some first paragraph </p>
<br>
<p> a second paragraph </p>
<br>
<p> a third thing </p>
New users find behavior like this confusing all the time.[0] - http://www.w3.org/TR/html5/syntax.html#void-elements |
|
The "/>" is syntax for a self-closing tag in xhtml (e.g. you were supposed to use <img src="" /> etc).
You see "<br />" a lot in php forums because these will often filter user input through the function nl2br whose purpose is to add HTML linebreaks wherever a person has a newline in their post. PHP's nl2br function by default inserts "<br />" unless you tell it specifically not to use xhtml-compatible linebreaks.