Mozilla translates <br></br> as <br></br><br></br> - html

Our CMS outputs linebreaks as <br></br> (stupid, i know, but syntactically corrent(?))
This translates to <br><br> in chrome and IE10 and to <br></br><br></br> in Firefox.
All browsers shows it as two linebreaks.
Why are not <br></br> translated like <br /> or just <br>, is there something i can do
to make browser interpret <br></br> as just one linebreak?

It's defined by the HTML5 specifications: http://www.w3.org/TR/html5/syntax.html#parsing-main-inbody (search the text An end tag whose tag name is "br" in the page).
If your document is parsed as an HTML document, each closing br tag will be always parsed as if it was an opening tag (and creates an element with no content). But if you parse your document as an XHTML document a <br></br> sequence will produce the same DOM tree as the <br/> tag. To have your document parsed as an XHTML document, you have to send it with the application/xhtml+xml mime type.
More details are available in the specifications: http://www.w3.org/TR/html5/introduction.html#html-vs-xhtml; http://www.w3.org/TR/html5/the-xhtml-syntax.html.

To answer your question... seeing as your CMS seems to output this abomination, if you need a quick fix...
Fiddle - http://jsfiddle.net/P6bDp/
Bonus CSS selector list - http://net.tutsplus.com/tutorials/html-css-techniques/the-30-css-selectors-you-must-memorize/
CSS
br + br {display: none;}
This will eliminate the second <br> and leave a single line break. Fix that CMS though :)

hey <br></br> is not syntactically correct, you must use it as <br/> (look at the slash). its inline element so no need to close like other elements. it closes itself

Related

Why does a stray </p> end tag generate an empty paragraph?

Apparently, if you have a </p> end tag with no matching start tag within the body element, most if not all browsers will generate an empty paragraph in its place:
<!DOCTYPE html>
<title></title>
<body>
</p>
</body>
Even if any text exists around the end tag, none of it is made part of this p element — it will always be empty and the text nodes will always exist on their own:
<!DOCTYPE html>
<title></title>
<body>
some text</p>more text
</body>
If the above contents of body are wrapped in <p> and </p> tags... I'll leave you to guess what happens:
<!DOCTYPE html>
<title></title>
<body>
<p>some text</p>more text</p>
</body>
Interestingly, if the </p> tag is not preceded by a <body> or </body> tag, all browsers except IE9 and older will not generate an empty paragraph (IE ≤ 9 on the other hand will always create one, while IE10 and later behave the same as all other browsers):
<!DOCTYPE html>
<title></title>
</p>
<!DOCTYPE html>
<title></title>
</p><body>
<!DOCTYPE html>
<title></title>
</p></body>
I can't find any references stipulating that an end tag with no corresponding start tag should generate an empty element, but that shouldn't come across as surprising considering that it's not even valid HTML in the first place. Indeed, I've only found browsers to do this with the p element (and to some extent the br element as well!), but not any explanation as to why.
It is rather consistent across browsers using both traditional HTML parsers and HTML5 parsers, though, applying both in quirks mode and in standards mode. So, it's probably fair to deduce that this is for backward compatibility with early specifications or legacy behavior.
In fact, I did find this comment on an answer to a somewhat related question, which basically confirms it:
The reason why <p> tags are valid unclosed is that originally <p> was defined as a "new paragraph" marker, rather than p being a container element. Equivalent to <br> being a "new line" marker. You can see so defined in this document from 1992:http://www.w3.org/History/19921103-hypertext/hypertext/WWW/MarkUp/Tags.html and this one from 1993: http://www.w3.org/MarkUp/draft-ietf-iiir-html-01.txt Because there were web pages pre-dating the change and browser parsers have always been as backward compatible as possible with existing web content, it's always stayed possible to use <p> that way.
But it doesn't quite explain why parsers treat an explicit </p> end tag (with the slash) as simply... a tag, and generate an empty element in the DOM. Is this part of some parser error handling convention from way back when the syntax wasn't as strictly defined as it was more recently or something? If so, is it documented anywhere at all?
That it is required is documented in HTML5. See http://w3c.github.io/html/syntax.html#the-in-body-insertion-mode and search down for An end tag whose tag name is "p" and it says:
If the stack of open elements does not have an element in button scope
with the same tag name as that of the token, then this is a parse
error; act as if a start tag with the tag name "p" had been seen, then
reprocess the current token.
Which translated into English means create a p element if the </p> tag can't be matched with an existing <p> tag.
Why it is so, is harder to ascertain. Usually, this is because some browser in the past caused this to happen as a bug, and web pages came to rely on the behaviour, so other browsers had to implement it too.
The HTML4 DTD states that the end tag is optional for the paragraph element, but the start tag is required.
The SGML declaration for HTML4 states that omittag is 'yes', which means that the start tag can be implied.
The end tag follows SGML rules:
an end tag closes, back to the matching start tag, all unclosed intervening start tags with omitted end tags
Anonymous block boxes are generated for inline elements such as text nodes, so they need not be wrapped by the paragraph element.
There's a thread in the Mozilla bug database which explains this behaviour:
Mozilla parses "half-tags" gullibly, leading to XSS security problems
Here's a relevant comment by Boris Zbarsky:
Actually, as I understand it, proper parsing of SGML/HTML requires that we
behave this way. That is, the '<' of the next tag is a valid way to close out
the markup of a previous tag...
And summarized by Ian Hickson:
The basic principle at work here, it appears, is that the markup is fixed up by delaying any closing tags until after all other open elements have been closed, and no attempt is made to make the DOM follow the HTML DTD.
References
SGML Productions
HTML 2.0 Specification
Arguments against SGML
Tag Soup: How UAs handle
Tag Soup: How Mac IE 5 and Safari handle
Web SGML and HTML 4.0 Explained
Testing SGML SHORTTAG support across browsers
Mozilla Bug 226495
Shorttag and Omittag
Jotting on parsers for SGML-family document languages: SGML, HTML, XML
A brief, opinionated history of XML - bobdc.blog

Why does self closing tag work in a html document?

I have a html document:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" >
In it I have tags such as
<br />
But Im reading that this tag is an XHTML element. Yet it still works why?
Original answer based on the question as written before a character was moved and completely changed it:
But Im reading that </br> is an XHTML element.
It isn't. Is is the end tag for an element.
<br /> would be a self closing tag (representing an entire element) in XHTML. In HTML 4 it means the same as <br>> (although most browsers don't respect that) and in HTML 5 the / is meaningless syntactic sugar to keep people used to XHTML happy.
In XHTML <br/> means the same as <br></br> (the latter is an error in HTML documents).
Yet it still works why?
Browsers perform enormous amounts of error correction to try to deal with the sort of bad markup that was prevalent in the late 90s.
They are not always consistent in how they recover from different errors (for example, I believe that some browsers will ignore that completely while others will treat it as a line break), so you should never depend on this behaviour.
Browsers failed to implement parsers that correctly handled HTML 4 and earlier.
They should have treated <br/> as "A br element followed by a greater than sign", but instead implemented it as "A br element with a / attribute, what's a / attribute? We'll drop it". This led to the feature being marked as something to avoid.
XHTML then exploited the bug for HTML-Compatible XHTML.
HTML 5 then redefined it as syntactic sugar so the XHTML junkies could keep on using the syntax they were used to.
It's the browser that get rid of these differences. Anyways the </br> with that slash is incorrect both in HTML and XHTML.
Occurring to http://www.w3schools.com/tags/tag_br.asp
In HTML the <br> tag has no end tag.
In XHTML the <br> tag must be properly
closed, like this: <br />.
Self closing tag is valid format in XML
XHTML means all tag must be closed
HTML
<br> valid
<br/> valid
XHTML
<br> invalid
<br/> valid
Edited:
</br> is invalid anyway and you are lucky if browser fix it :)
</br> is the same as <div id="gd"/>, both are invalid

What do you call tags that need no ending tag?

There are HTML tags, such as <img />, <input /> and <button />, that need no ending tag (</img>, </input> and </button>). What is the term that describes this type of tags?
This syntax has a variety of names depending on what language you are using. The best way to find out what it is called is to look at the specification for the specific language.
HTML 4.x
I can't find any mention of this syntax in the HTML 4.x specification. It is not valid syntax.
HTML 5
In the HTML 5 specification the / character (called a SOLIDUS) is valid but has no effect for void elements such as <br />, <hr />, <img />, <input />, etc. and for foreign elements (such as SVG tags) it designates a start tag that is marked as self-closing. It is not a valid syntax for all other tags (such as <button /> mentioned in your question).
Then, if the element is one of the void elements, or if the element is a foreign element, then there may be a single U+002F SOLIDUS character (/). This character has no effect on void elements, but on foreign elements it marks the start tag as self-closing.
XML
According to the XML specification it is called an empty-element tag:
The representation of an empty element is either a start-tag immediately followed by an end-tag, or an empty-element tag.
XHTML
According to the XHTML specification it is called the minimized tag syntax for empty elements:
C.2. Empty Elements
Include a space before the trailing / and > of empty elements, e.g. <br />, <hr /> and <img src="karen.jpg" alt="Karen" />. Also, use the minimized tag syntax for empty elements, e.g. <br />, as the alternative syntax <br></br> allowed by XML gives uncertain results in many existing user agents.
C.3. Element Minimization and Empty Element Content
Given an empty instance of an element whose content model is not EMPTY (for example, an empty title or paragraph) do not use the minimized form (e.g. use <p> </p> and not <p />).
In general if you want to be precise I would recommend using the names as defined in the appropriate standard. Then if people aren't exactly sure what you mean they can look it up in the standard to find out. However if you don't want to use the name in the standard you are free to call it something else if you want. The important thing is that the people who communicate with you can understand you. I don't think anyone would misunderstand you if you used the term 'self-closing tag' for a tag in an XML document even if the standard officially calls it something else.
Thanks to Alohci for the HTML 5 reference.
The term is self-closing.
HTML tags can be of two types. They are
Paired Tags
Unpaired Tags
Paired Tags:
A tag is said to be a paired tag if the text is placed between a tag and its companion tag. In paired tags, the first tag is referred to as Opening Tag and the second tag is referred to as Closing Tag.
Example:
<i>This text is in italics. </i>
Note: Here <i> is called opening tag. and </i> is called closing tag.
Unpaired Tags:
An unpaired tag does not have a companion tag. Unpaired tags are also known as Singular or Stand-Alone Tags.
Example : <br> , <hr> etc. These tags does not require any companion tag.
Those tags are called "Standalone Tags". Standalone tags are having no closing tags in HTML
But in XHTML they have to be self closed by adding forward slash before the closing angular bracket
I've always called them Singleton tags!
Optional closing tags like p, li, etc.
It is also worth mentioning that several other tags besides those mentioned in the question don't need a closing tag: they just close automatically when something specified in the standard appears.
For example:
<body>
<p>abc
<p>def
</body>
is equivalent to:
<body>
<p>abc
</p>
<p>def
</p>
</body>
because the p closes both at:
the start of another p
when the parent of the p closes
This is specified at 12.1.2.4 "Optional tags" https://html.spec.whatwg.org/multipage/syntax.html#optional-tags but I don't think there's an actual name besides "an element with an optional closing tag".
See also: P-end-tag (</p>) is not needed in HTML
That is called a self closing tag
There are paired and unpaired tags.
Unpaired tags are opened and do not have to be closed. They stand alone.
<img />, <input /> and <button />
I know them as bachelor tags.
e.g. here: http://moodle.cs.huji.ac.il/cs09/file.php/67782/xml-intro.pdf (page 30)
I've called them self-closing, single tags and monotags, I don't know why I haven't adopted a single term though.
I've seen them referred to as singlet (Which is presumably a short form of single-tag)
This sort of Element is an empty element (since it does not contain anything, it just may have attributes). That's the correct way according to the specification, AFAIK. (If the Element is not empty, the Element consists of the opening tag, the closing tag, and the content inbetween.)
Those tags are also called "unpaired", "single", or "bachelor tags". The term "self-closing" I don't like because they don't close themselves any more than other tags, it's still you or your program that puts the "/>" in there.
According to here:
An element consists of a start tag, content, and an end tag.

Are there any issues with always self closing empty tags in html?

Are there any browser issues with always collapsing empty tags in html.
So for example an empty head tag can be written like this
<head></head>
but is can also be written like this
<head/>
Will the second case cause issues in any scenerio?
Thanks
Self-closing <script> tags can mess up some browsers really badly. I remember my whole page disappearing into thin air in IE after I self-closed a script tag - everything after it was read as a script.
Assuming that you are serving your XHTML as XML, no. <head></head> is entirely equivalent to <head />. In fact, an XML parser won't even bother to tell you which one you have.
(There is, however, an issue in that the <head> tag must contain a <title>.)
You shouldn't use minimized form for head in XHTML.
http://www.w3.org/TR/xhtml1/#guidelines
About empty elements:
http://www.w3.org/TR/xhtml1/#C_3
Given an empty instance of an element
whose content model is not EMPTY (for
example, an empty title or paragraph)
do not use the minimized form (e.g.
use <p> </p> and not <p />).
In other words, paragraph should always be closed in XHTML, in HTML you could go with only opening tag. But if the element is supposed to have content it should be properly opened and closed.
For example line break has EMPTY content model and can be written as <br /> (same goes for <hr />) but not <div />.
Also see this SO question.
Empty Elements (XHTML)
Shorthand markup in HTML
Self-closing tags don't exist in HTML. The / is always ignored, that is, <foo/> and <foo> are equivalent. For elements such as br, that's fine, because you want <br>. However, <script src="..." /> means the same as <script src="...">, which is a problem (as noted in other answers). <head/> is less of a problem, because the </head> end tag is optional anyway.
In XML, on the other hand, self-closing tags do what you want. However, you probably aren't using XML, even if you've got an XHTML doctype. Unless you send your documents with a text/xml, application/xml or application/xhtml+xml MIME type (or any other XML MIME type), particularly if you send them as text/html, they will not be treated as XML.
Not that I am aware of. One caveat that has bitten me in the past is self closing my script tag: <script type="text/javascript" src="somefile.js" />
This results in some interesting fail.
In general an empty element can be written as a self closing tag, or opening and closing tags.
However, the HTML4 DTD specifies that the document HEAD must contain a TITLE element.
"Every HTML document must have a TITLE element in the HEAD section."
http://www.w3.org/TR/1999/REC-html401-19991224/struct/global.html#h-7.4.1
I believe some older browsers had problems with the lack of whitespacing - in particular
<head/> would be interpreted as a "head/" tag, whereas <head /> will be interpreted as a "head" tag with a blank attribute "/" which is ignored.
This only affects a few browsers, AFAIK. Either is valid XHTML, but older HTML-only browsers might have trouble.
This is in fact documented in the XHTML guidelines as C.2
Even considering only browser issues (i.e. disregarding validity) and narrowing the question down to the head tag alone, the answer is still yes.
Compare
<head/>
<object>Does this display?</object>
against
<head></head>
<object>Does this display?</object>
each served as text/html to any version of IE.
Does this display? will be shown only in the latter example.

HTML 5: Is it <br>, <br/>, or <br />?

This question's answers are a community effort. Edit existing answers to improve this post. It is not currently accepting new answers or interactions.
I've tried checking other answers, but I'm still confused — especially after seeing W3schools HTML 5 reference.
I thought HTML 4.01 was supposed to "allow" single-tags to just be <img> and <br>. Then XHTML came along with <img /> and <br /> (where someone said that the space is there for older browsers).
Now I'm wondering how I'm supposed to format my code when practicing HTML 5.
Is it <br>, <br/> or <br />?
Simply <br> is sufficient.
The other forms are there for compatibility with XHTML; to make it possible to write the same code as XHTML, and have it also work as HTML. Some systems that generate HTML may be based on XML generators, and thus do not have the ability to output just a bare <br> tag; if you're using such a system, it's fine to use <br/>, it's just not necessary if you don't need to do it.
Very few people actually use XHTML, however. You need to serve your content as application/xhtml+xml for it to be interpreted as XHTML, and that will not work in old versions of IE - it will also mean that any small error you make will prevent your page from being displayed in browsers that do support XHTML. So, most of what looks like XHTML on the web is actually being served, and interpreted, as HTML. See Serving XHTML as text/html Considered Harmful for some more information.
I think this quote from the HTML 5 Reference Draft provides the answer:
3.2.2.2 Void Elements
The term void elements is used to designate elements that must be empty. These requirements only apply to the HTML syntax. In XHTML, all such elements are treated as normal elements, but must be marked up as empty elements.
These elements are forbidden from containing any content at all. In HTML, these elements have a start tag only. The self-closing tag syntax may be used. The end tag must be omitted because the element is automatically closed by the parser.
HTML Example:
A void element in the HTML syntax. This is not permitted in the XHTML syntax.
<hr>
Example:
A void element using the HTML- and XHTML-compatible self-closing tag syntax.
<hr/>
XHTML Example:
A void element using the XHTML-only syntax with an explicit end tag. This is not permitted for void elements in the HTML syntax.
<hr></hr>
In other words:
Invalid HTML 5: <IMG></IMG>
Valid HTML 5: <IMG>, <IMG/>
And while HTML forbids certain closing tags, xhtml requires them:
Invalid xhtml: <img>
Valid xhtml: <img></img> or <img/>
Other elements that are forbidden from having a closing tag in HTML:
Element
Valid HTML
Valid xhtml
AREA
<AREA>
<AREA></AREA>
BASE
<BASE>
<BASE></BASE>
BASEFONT
<BASEFONT>
<BASEFONT></BASEFONT>
BR
<BR>
<BR></BR>
COL
<COL>
<COL></COL>
FRAME
<FRAME>
<FRAME></FRAME>
HR
<HR>
<HR></HR>
IMG
<IMG>
<IMG></IMG>
INPUT
<INPUT>
<INPUT></INPUT>
ISINDEX
<ISINDEX>
<ISINDEX></ISINDEX>
LINK
<LINK>
<LINK></LINK>
META
<META>
<META></META>
PARAM
<PARAM>
<PARAM></PARAM>
The fact that HTML forbids certain closing tags, while xhtml requires them is xhtml's problem. If you're writing HTML, you follow the HTML rules.
At the same time, browers gave up trying to enforce the standards, because everyone gets it wrong. It's not obvious:
that </BR> is forbidden
that </P> is optional
and </SPAN> is required
And then xhtml came along, with its XML rule that every element must have a closing tag, and people just assumed that HTML was the same thing. So the standards gave up, and were later revised to throw up their hands to the reality.
XML doesn't allow leaving tags open, so it makes <br> a bit worse than the other two. The other two are roughly equivalent with the second (<br/>) preferred for compatibility with older browsers. Actually, space before / is preferred for compatibility sake, but I think it only makes sense for tags that have attributes. So I'd say either <br/> or <br />, whichever pleases your aesthetics.
To sum it up: all three are valid with the first one (<br>) being a bit less "portable".
Edit: Now that we're all crazy about specs, I think it worth pointing out that according to dev.w3.org:
Start tags consist of the following
parts, in exactly the following order:
A "<" character.
The element’s tag name.
Optionally, one or more attributes, each of which must be
preceded by one or more space
characters.
Optionally, one or more space characters.
Optionally, a "/" character, which may be present only if the
element is a void element.
A ">" character.
In HTML (up to HTML 4): use <br>
In HTML 5: <br> is preferred, but <br/> and <br /> is also acceptable
In XHTML: <br /> is preferred. Can also use <br/> or <br></br>
Notes:
<br></br> is not valid in HTML 5, it will be thought of as two line breaks.
XHTML is case sensitive, HTML is not case sensitive.
For backward compatibility, some old browsers would parse XHTML as HTML and fail on <br/> but not <br />
Reference:
http://www.w3schools.com/tags/tag_br.asp
http://en.wikipedia.org/wiki/XHTML
According to the spec the expected form is <br> for HTML 5 but a closing slash is permitted.
I would recommend using <br /> for the following reasons:
1) Text and XML editors that highlight XML syntax in different colours will highlight properly with <br /> but this is not always the case if you use <br>
2) <br /> is backwards-compatible with XHTML and well-formed HTML (ie: XHTML) is often easier to validate for errors and debug
3) Some old parsers and some coding specs require the space before the closing slash (ie: <br /> instead of <br/>) such as the WordPress Plugin Coding spec: http://make.wordpress.org/core/handbook/coding-standards/html/
I my experience, I have never come across a case where using <br /> is problematic, however, there are many cases where <br/> or especially <br> might be problematic in older browsers and tools.
XML requires all tags to have a corresponding closing tag. So there is a special short-hand syntax for tags without inner contents.
HTML5 is not XML, so it should not pose such a requirement. Neither is HTML 4.01.
For instance, in HTML5 specs, all examples with br tag use <br> syntax, not <br/>.
UPD Actually, <br/> is permitted in HTML5. 9.1.2.1, 7.
If you're interested in comparability (not compatibility, but comparability) then I'd stick with <br />.
Otherwise, <br> is fine.
Both <br> and <br /> are acceptable in HTML5, but in the spirit of HTML, <br> should be used. HTML5 allows closing slashes in order to be more compatible with documents that were previously HTML 4.01 and XHTML 1.0, allowing easier migration to HTML5. Of course, <br/> is also acceptable, but to be compatible with some older browsers, there should be a space before the closing slash (/).
If you are outputting HTML on a regular website you can use <br> or <br/>, both are valid anytime you are serving HTML5 as text/html.
If you are serving HTML5 as XHTML (i.e. content type application/xhtml+xml, with an XML declaration) then you must use a self closing tag like so: <br/>.
If you don't the some browsers may flat out refuse to render your page (Firefox in particular is very strict about rendering only valid xhtml+xml pages).
As noted in 1. <br/> is also valid for HTML5 that happens to be generated as XML but served as a regular text/html without an XML declaration (such as from an XSL Transform that generates web pages, or something similar).
To clear up confusion: Putting a space before the slash isn't required in HTML5 and doesn't make any difference to how the page is rendered (if anyone can cite an example I'll retract this, but I don't believe it's true - but IE certainly does a lot of other odd things with all forms of <br> tags).
The excellent validator at http://validator.w3.org is really helpful for checking what's valid (although I'm not sure you can rely on it to also check content-type).
<br> is sufficient but in XHTML <br /> is preferred according to the WHATWG and according to the W3C.
To quote Section 8.1.2.1 of HTML 5.2 W3C Recommendation, 14 December 2017
Start tags must have the following format:
…
After the attributes, or after the tag name if there are no attributes, there may be one or more space characters. (Some attributes are required to be followed by a space. See §8.1.2.3 Attributes below.)
Then, if the element is one of the void elements, or if the element is a foreign element, then there may be a single U+002F SOLIDUS character (/). This character has no effect on void elements, but on foreign elements it marks the start tag as self-closing.
If you use Dreamweaver CS6, then it will autocomplete as <br />.
To validate your HTML file on W3C see : http://validator.w3.org/
<br> and <br/> render differently. Some browsers interpret <br/> as <br></br> and insert two line breaks
<br/> is the most appropriate one. This tag notation can also be used in Reactjs where a line break is required instead of <br>
Most of the cases in HTML, the tags are in pair. But for a line break you don't need a pair of tags. Therefore to indicate this, HTML uses <br/> format. <br/> is the right one. Use that format.
<br> tag has no end tag in HTML
In XHTML, the <br> tag must be properly closed, like this: <br />
In XML every tag must be closed. XHTML is an extension of XML, hence all the rules of XML must be followed for valid XHTML. Hence even empty tags (nodes without child nodes) like should be closed. XML has a short form called self closing tags for empty nodes. You can write <br></br> as <br />. Hence in XHTML <br /> is used.
HTML is very lenient in this regard, and there is no such rule. So in HTML empty nodes like <br> <hr> <meta> etc are written without the closing forward slash.
HTML
<br>
<hr>
<meta name="keywords" content="">
<link rel="canonical" href="http://www.google.com/">
XHTML
<br />
<hr />
<meta name="keywords" content="" />
<link rel="canonical" href="http://www.google.com/" />
Not all tags can be self closed. For example, a tag like <script src="jQuery.min.js" /> is not allowed by XHTML DTD.
Well all I know is that <br /> gives a break with a white line and <br> just gives a break in some cases. This happened to me when I was setting up an IPN-script (PHP) and sent mails and checked the inbox for it. Dont know why but I only got the message to look neat using both <br /> and <br>
Have a look at the mail here: http://snag.gy/cLxUa.jpg
The first two sections of text is seperated by <br />, hence the whitespace lines, the last three rows of text in the bottom and the last section is seperated by <br> and just gives new row.
Ummm.....does anyone know a SINGLE vendor, user-agent, or browser maker that has ever followed the W3C Specifications 100%??? So if HTML5 says it supports all three break element versions, you can bet the vendors support the same and even more sloppier versions!
The ONLY thing that matters in this debate is to CONSISTENTLY use coding that also happens to follow XML specifications as well as HTML specifications when possible. That means you should use the correct XML version of the break tag and encourage all your team to do the same:
<br />
The same space-slash format should apply for the img, a, hr, and meta tags in your code. Why? Because:
Its is backwards compatible with older XHTML user-agents / browsers
The browser vendors support the XML version anyway so the HTML5 specification is moot.
The sloppy implementations of most user-agents today, in the past, and in the future will accept it.
It allows your markup to be comparable with XML standards should you need to go back to creating XHTML/XML documents from your markup.
It's "good coding practice" for ALL WEB DEVELOPERS to keep using solid markup practices that follow XML, including coding in all lower case, quoted attributes, escaped XML characters, etc. etc. Why? In the future if you have to switch to XML data you automatically code and think in XML.
We can only hope that in the future World Wide Web, we move away from private vendor-implemented standards and go back to solid, reliable, verified markup that parses faster, moves data over the wires faster, and make our future Internet a more standardized medium using XML.
Old Netscape always needed the " /" space before the slash or it failed. Who cares about old browsers, right? But its one more case for my version I still like :)
Besides, in the robotic and machine world that's here, where robots don't have the same Human-interface coding problems HTML5 solves for us, they will gladly go back to XML data systems and parse such UI web pages much faster when converted to XML data.
<br> and <br /> render differently in some browsers, so choosing either over the other isn't going to hurt your project, but do expect a bulk find..replace to affect the page render in some browsers, which may result in extra work for yourself or even embarrassment should the change affect nothing in your test browser, but break it in the preferred browser of your clients'.
I prefer <br> since it is what I have used since Erwise and Netscape Navigator (early web browsers), but there's no reason not to choose <br /> instead. It may be useful for some preprocessing, comparability, etc.
Even if your choice boils down to preferring the look of one over the other, or you (or your favourite HTML editor e.g. Dreamweaver) might like your code to be xml compliant. It's up to you.
A quick side note:
Not to be confused with br, but in addition you may also consider using wbr tags in your HTML: A word break opportunity tag, which specifies where in a text it would be ok to add a line-break.
For further reading, please have a read of the HTML5 spec.
The elements without having end tags are called as empty tags. In html 4 and html 5, end tags are not required and can be omitted.
In xhtml, tags are so strict. That means must start with start tag and end with end tag.