14 Replies Latest reply on May 8, 2006 9:01 AM by Newsgroup_User

    <br /> vs <br>

    Level 7
      I hear it's "better" to use <br /> instead of <br>

      I always figured that as long as DW does it <br>, reports of <br /> being
      "the way to go" have been greatly exagerrated.

      What's the deal with closing tags like these vs leaving them open?


        • 1. Re: &lt;br /&gt; vs &lt;br&gt;
          Level 7
          <br /> is the xhtml standard. XHTML mandates that every opening tag must have a closing tag. Since <br>, <hr>, etc. do not have a matching closing tag
          they are to be self closed. When you create a new document and choose the document type, you are given the option to make it xhtml complaint. This
          will change DW's default behavior to create <br /> tags. If you already have a document started you can go to File>Convert>XHTML and it will change
          your tags for you.
          At least in MX 2004.

          stillwaiting

          p.s. And as always I am probably wrong on some point so anyone feel free to correct me. That way I can hone my knowledge and Reese won't get confused.


          > I hear it's "better" to use <br /> instead of <br>
          >
          > I always figured that as long as DW does it <br>, reports of <br /> being
          > "the way to go" have been greatly exagerrated.
          >
          > What's the deal with closing tags like these vs leaving them open?
          >
          >
          • 2. Re: &lt;br /&gt; vs &lt;br&gt;
            Level 7
            <br> is part of the vocabulary of HTML.

            <br /> is part of the vocabulary of XHTML.

            More here:
            http://www22.brinkster.com/beeandnee/techzone/articles/htmltoxhtml.asp
            http://webdesign.about.com/cs/xhtmlxml/a/aa013100b.htm

            Note: there is very little practical reason or benefit in using XHTML at the
            moment.
            Well-formed HTML pages will be fine for many years to come.

            --
            Regards

            John Waller


            • 3. Re: &lt;br /&gt; vs &lt;br&gt;
              Level 7
              John Waller wrote:
              > Note: there is very little practical reason or benefit in using XHTML at the
              > moment.
              > Well-formed HTML pages will be fine for many years to come.

              Both points are perfectly true.

              It's also true that well-formed XHTML pages will be fine for many years
              to come. Since all standards-compliant books that I have read in recent
              years teach XHTML, and Dreamweaver 8 uses XHTML 1.0 Transitional as the
              default DTD, there is very little practical reason or benefit not to use it.

              The important point is to make sure you don't mix HTML and XHTML coding
              in the same page.

              --
              David Powers
              Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
              Author, "Foundation PHP 5 for Flash" (friends of ED)
              http://foundationphp.com/
              • 4. Re: &lt;br /&gt; vs &lt;br&gt;
                Level 7
                > It's also true that well-formed XHTML pages will be fine for many years to
                > come. Since all standards-compliant books that I have read in recent years
                > teach XHTML, and Dreamweaver 8 uses XHTML 1.0 Transitional as the default
                > DTD, there is very little practical reason or benefit not to use it.

                True enough if you're creating new pages and sites.

                I guess the main issue today is whether there is any point in converting
                existing HTML pages to XHTML?

                --
                Regards

                John Waller


                • 5. Re: &lt;br /&gt; vs &lt;br&gt;
                  Level 7
                  John Waller wrote:
                  > True enough if you're creating new pages and sites.
                  >
                  > I guess the main issue today is whether there is any point in converting
                  > existing HTML pages to XHTML?

                  I don't think there's any advantage in converting legacy sites, but it's
                  probably worth converting pages as they're replaced. What concerns me
                  are statements that suggest there's no point in using XHTML. XHTML 1.0
                  is simply HTML 4.01 reformulated to follow the rules of XML.

                  Even though XHTML 2.0 is likely to differ considerably from XHTML 1.0,
                  pages written in well-formed XHTML 1.0 with the correct DTD are likely
                  to be supported by any XML compliant browser. How long HTML 4.01 will
                  continue to be supported is anybody's guess - although I imagine it will
                  be quite a long time. Vinyl records, after all, haven't disappeared
                  entirely.

                  --
                  David Powers
                  Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
                  Author, "Foundation PHP 5 for Flash" (friends of ED)
                  http://foundationphp.com/
                  • 6. Re: &lt;br /&gt; vs &lt;br&gt;
                    Level 7
                    4-Track tapes, perhaps.... 8)

                    --
                    Murray --- ICQ 71997575
                    Adobe Community Expert
                    (If you *MUST* email me, don't LAUGH when you do so!)
                    ==================
                    http://www.dreamweavermx-templates.com - Template Triage!
                    http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
                    http://www.dwfaq.com - DW FAQs, Tutorials & Resources
                    http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
                    ==================


                    "David Powers" <david@example.com> wrote in message
                    news:e3nekk$d03$1@forums.macromedia.com...
                    > John Waller wrote:
                    >> True enough if you're creating new pages and sites.
                    >>
                    >> I guess the main issue today is whether there is any point in converting
                    >> existing HTML pages to XHTML?
                    >
                    > I don't think there's any advantage in converting legacy sites, but it's
                    > probably worth converting pages as they're replaced. What concerns me are
                    > statements that suggest there's no point in using XHTML. XHTML 1.0 is
                    > simply HTML 4.01 reformulated to follow the rules of XML.
                    >
                    > Even though XHTML 2.0 is likely to differ considerably from XHTML 1.0,
                    > pages written in well-formed XHTML 1.0 with the correct DTD are likely to
                    > be supported by any XML compliant browser. How long HTML 4.01 will
                    > continue to be supported is anybody's guess - although I imagine it will
                    > be quite a long time. Vinyl records, after all, haven't disappeared
                    > entirely.
                    >
                    > --
                    > David Powers
                    > Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
                    > Author, "Foundation PHP 5 for Flash" (friends of ED)
                    > http://foundationphp.com/


                    • 7. Re: &lt;br /&gt; vs &lt;br&gt;
                      Level 7
                      > The important point is to make sure you don't mix HTML and XHTML coding in
                      > the same page.

                      though that won't hurt anything, especially if you are not serving your
                      xhtml pages as xml (most xhtml pages AREN'T being served as xml)

                      By the time we start serging xhtml as xml, we'll likely be at the 2.0 stage
                      for xhtml anyways.

                      -Darrel


                      • 8. Re: &lt;br /&gt; vs &lt;br&gt;
                        Level 7
                        >What concerns me are statements that suggest there's no point in using
                        >XHTML. XHTML 1.0 is simply HTML 4.01 reformulated to follow the rules of
                        >XML.

                        Right. There is a point in using it...namely if you need to parse your xhtml
                        as xml. But that's really the only reason to do it.

                        It's great to go with xhtml, but most of the time, it's not done for any
                        particular technological reason.

                        > How long HTML 4.01 will continue to be supported is anybody's guess -
                        > although I imagine it will be quite a long time. Vinyl records, after all,
                        > haven't disappeared entirely.

                        Vinyl is actually seeing a resurgence.

                        Seeing as how HTML was the basic concept of the WWW, I imagine it will be
                        supported as long as the current WWW is around.

                        -Darrel


                        • 9. Re: &lt;br /&gt; vs &lt;br&gt;
                          Level 7
                          darrel wrote:
                          >>The important point is to make sure you don't mix HTML and XHTML coding in
                          >>the same page.
                          >
                          > though that won't hurt anything, especially if you are not serving your
                          > xhtml pages as xml (most xhtml pages AREN'T being served as xml)

                          Bad coding is bad coding, even if it does still work. Anyone who relies
                          on browsers to continue to support their mistakes is in for a very rude
                          shock when pages are eventually served as XML.

                          I have a couple of pages that I serve as application/xhtml+xml to
                          browsers that understand it. A single mistake renders the whole page
                          unviewable. It's never too early to get into the habit of using clean,
                          valid code.

                          --
                          David Powers
                          Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
                          Author, "Foundation PHP 5 for Flash" (friends of ED)
                          http://foundationphp.com/
                          • 10. Re: &lt;br /&gt; vs &lt;br&gt;
                            Level 7
                            Surprisingly, I agree 100%. 8)

                            --
                            Murray --- ICQ 71997575
                            Adobe Community Expert
                            (If you *MUST* email me, don't LAUGH when you do so!)
                            ==================
                            http://www.dreamweavermx-templates.com - Template Triage!
                            http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
                            http://www.dwfaq.com - DW FAQs, Tutorials & Resources
                            http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
                            ==================


                            "David Powers" <david@example.com> wrote in message
                            news:e3nm0c$mvf$1@forums.macromedia.com...
                            > darrel wrote:
                            >>>The important point is to make sure you don't mix HTML and XHTML coding
                            >>>in the same page.
                            >>
                            >> though that won't hurt anything, especially if you are not serving your
                            >> xhtml pages as xml (most xhtml pages AREN'T being served as xml)
                            >
                            > Bad coding is bad coding, even if it does still work. Anyone who relies on
                            > browsers to continue to support their mistakes is in for a very rude shock
                            > when pages are eventually served as XML.
                            >
                            > I have a couple of pages that I serve as application/xhtml+xml to browsers
                            > that understand it. A single mistake renders the whole page unviewable.
                            > It's never too early to get into the habit of using clean, valid code.
                            >
                            > --
                            > David Powers
                            > Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
                            > Author, "Foundation PHP 5 for Flash" (friends of ED)
                            > http://foundationphp.com/


                            • 11. Re: &lt;br /&gt; vs &lt;br&gt;
                              Level 7
                              .oO(darrel)

                              >> The important point is to make sure you don't mix HTML and XHTML coding in
                              >> the same page.
                              >
                              >though that won't hurt anything, especially if you are not serving your
                              >xhtml pages as xml (most xhtml pages AREN'T being served as xml)

                              <br /> has a different meaning in HTML.
                              <meta ... /> in HTML will make the document invalid.

                              Micha
                              • 12. Re: &lt;br /&gt; vs &lt;br&gt;
                                Level 7

                                > Bad coding is bad coding, even if it does still work.

                                But most XHTML is perfectly valid HTML.

                                Self closing tags, for instance, are fine in HTML. HTML just ignores the
                                self closing part.

                                I try to stick with XHTML, but don't loose sleep when the CMS or other IDE
                                slaps in HTML. It used to bother me, but now I take a more pragmatic
                                approach to it.

                                > Anyone who relies on browsers to continue to support their mistakes is in
                                > for a very rude shock when pages are eventually served as XML.

                                If you're making that concious decision to server your pages as XML, then
                                you'd want to use XHTML, sure. That was kind of my point. ;o)


                                > I have a couple of pages that I serve as application/xhtml+xml to browsers
                                > that understand it. A single mistake renders the whole page unviewable.
                                > It's never too early to get into the habit of using clean, valid code.

                                No argument there. I'm just saying HTML, even HTML 'dirtied' with some XHTML
                                can still be perfectly valid code.

                                -Darrel


                                • 13. Re: &lt;br /&gt; vs &lt;br&gt;
                                  Level 7
                                  > <br /> has a different meaning in HTML.

                                  How so? My understanding is that HTML will recognize the BR and just ignore
                                  the closing character.

                                  > <meta ... /> in HTML will make the document invalid.

                                  Yes, true. Good point.

                                  -Darrel


                                  • 14. Re: &lt;br /&gt; vs &lt;br&gt;
                                    Level 7
                                    .oO(darrel)

                                    >> <br /> has a different meaning in HTML.
                                    >
                                    >How so? My understanding is that HTML will recognize the BR and just ignore
                                    >the closing character.

                                    Yep, most (in fact nearly all) browsers will do that, but the correct
                                    (SGML) interpretation would be

                                    <br>>

                                    Notice the second '>'. It's the same thing as with <meta ... /> etc.:
                                    the slash closes the tag, the following '>' should be interpreted as
                                    text.

                                    Have a look at this very simple code:

                                    =====
                                    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
                                    <title></title>

                                    <p>foo<br />bar</p>
                                    =====

                                    It validates as HTML, but have a look the parse tree:

                                    <HTML>
                                    <HEAD>
                                    <TITLE>
                                    </TITLE>
                                    </HEAD>
                                    <BODY>
                                    <P>
                                    foo
                                    <BR>
                                    </BR>
                                    >bar
                                    </P>
                                    </BODY>
                                    </HTML>

                                    http://validator.w3.org/check?uri=http%3A%2F%2Fmfesser.de%2Ftest%2Fbr.html&charset=%28dete ct+automatically%29&doctype=Inline&sp=1

                                    Micha