The <br> tag or <br />

Solved
faamugol -  
 rwaness -
Hello,

What is the difference between the <br> tag and the <br /> tag?

Why use one and not the other?

Thank you in advance,
Configuration: Windows XP Internet Explorer 7.0

2 answers

  1. jee pee Posted messages 31885 Registration date   Status Moderator Last intervention   9 980
     
    Hello,

    the second form comes from XHTML, which is the latest standard for web page structures, the rule being that every tag must be opened and every tag must be closed.

    Tags like br, which did not have a closing form in HTML, must therefore be opened and closed at the same time, giving
    <br />


    and this form should be preferred

    it's the same for a tag like img:
    <img src="image.gif" />


    Best regards
    170
    1. faamugol
       
      So, should we no longer use the <br> tag?
      Will this cause any problems later on?

      Thank you in advance,
      12
    2. Colas > faamugol
       
      A priori, browsers interpret <br> correctly as well. So, there’s no problem using it.

      The document will then be HTML and not XHTML. If the document is XHTML (see DTD, etc.), it could cause issues.
      2