How to close the break BR tag

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mariko
    New Member
    • Mar 2010
    • 23

    How to close the break BR tag

    I was taught to write <br/> but then I was later told to write <br />. Which is the correct way and does it make a difference?
  • MoinFaraz
    New Member
    • Mar 2010
    • 1

    #2
    &lt;br/&gt; or &lt;br /&gt;

    some tags don't have end {closing} tags, so its always better to close tags

    writing <br /> is recommended by newer version of w3c {world wide web consortium}

    Comment

    • Dormilich
      Recognized Expert Expert
      • Aug 2008
      • 8694

      #3
      if you not only write, but serve XHTML it doesn’t matter if you write <br/>, <br /> or even <br></br>.
      Originally posted by MoinFaraz
      writing <br /> is recommended by newer version of w3c {world wide web consortium}
      I’d like to have a link for that.

      Comment

      • mariko
        New Member
        • Mar 2010
        • 23

        #4
        It seems like it works no matter what I put. Why should it matter? Also, is it better to use css properties?

        Comment

        • jkmyoung
          Recognized Expert Top Contributor
          • Mar 2006
          • 2057

          #5
          Some people like to have a space in self closing tags to highlight them when looking through the code.
          I prefer conciseness so just put <br/>.

          Comment

          • drhowarddrfine
            Recognized Expert Expert
            • Sep 2006
            • 7434

            #6
            @mariko,
            I doubt you are serving xhtml and there is no such thing as <br/> in HTML so you should use <br>. Browsers treat <br/> as "tag soup" which is why it works, they're required to do the best they can with it.

            Comment

            • MusoFreak200
              New Member
              • Oct 2009
              • 96

              #7
              @ mariko

              i have always written in the old way...

              which is <br> for opening and </br> for closing...

              but <br /> is the new way but it won't matter if you are only using html and css but it will if you are using dhtml [aka, javascript, xhtml]

              i recomend to use the old way for html...

              many others will dissagree

              Comment

              • Dormilich
                Recognized Expert Expert
                • Aug 2008
                • 8694

                #8
                Originally posted by MusoFreak200
                but <br /> is the new way but it won't matter if you are only using html and css
                it’s not the "new" way, it is an empty element in XML

                Originally posted by MusoFreak200
                i recomend to use the old way for html...

                many others will dissagree
                well, I don’t. always use the proper style. (not something like writing XHTML and serving it as HTML)

                Comment

                Working...