Introduction to the difference between BR and br/in HTML

Source: Internet
Author: User
Tags empty

The rule in HTML is the BR empty tag, no terminator, but in XHTML, the stipulation is that the br/start tag is immediately followed by the end tag, please understand this

Answer from Stackflow:

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 is based on XML generators, and thus 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 don ' t need to do it.

Very Few people actually use XHTML, however. You are need to serve your content as application/xhtml+xml for it to is interpreted as XHTML, and that won't work in IE (i T would also mean that any small error your make would prevent your page from being displayed. In browsers TML). So, most of what looks like XHTML in the web is actually being served, and interpreted, as HTML. Serving XHTML as text/html considered harmful for some more information.

means that the rules in HTML are <br> null tags, no terminator, but in XHTML, the rulesIs the <br/> start tag immediately following the end tag.

,<br> tags in XHTML must be properly closed, such as: <br/>. The <br> tag is an empty label (meaning it has no end tag, so this is the wrong:<br></br>). In XHTML, the end tag is placed in the start tag, which is <br/>.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.