"BR" tag equivalent in XHTML Strict?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mohammd M. Hussain

    "BR" tag equivalent in XHTML Strict?

    Hi,

    I am writing an XHTML 1.0 Strict Compatible web page. However, the
    validator complained about the <br> tag. I wonder whether there is
    another alternative for this.

    Thanks,
  • David Dorward

    #2
    Re: &quot;BR&quo t; tag equivalent in XHTML Strict?

    Mohammd M. Hussain wrote:[color=blue]
    > I am writing an XHTML 1.0 Strict Compatible web page. However, the
    > validator complained about the <br> tag. I wonder whether there is
    > another alternative for this.[/color]



    However - in most cases, when people use <br> then either mean <li> or
    margin-bottom: 1em; (or larger).

    Why are you using XHTML anyway? http://www.hixie.ch/advocacy/xhtml

    --
    David Dorward <http://dorward.me.uk/>

    Comment

    • Jukka K. Korpela

      #3
      Re: &quot;BR&quo t; tag equivalent in XHTML Strict?

      mmkhajah@syr.ed u (Mohammd M. Hussain) wrote:
      [color=blue]
      > I am writing an XHTML 1.0 Strict Compatible web page. However, the
      > validator complained about the <br> tag.[/color]

      Then it had a reason to that. You asked it to check the syntax of your
      document against a formal definition that you refer to. And it did
      exactly that. If you are puzzled, that's because you don't know the
      formal definition that you referred to.

      There's formally nothing wrong with the <br> tag in XHTML 1.0 Strict
      per se. It's the context where you use it that matters. And you gave no
      hint of that, such as a URL.
      [color=blue]
      > I wonder whether there is
      > another alternative for this.[/color]

      The markup you use should depend on the logical structure of your
      document, which you haven't described at all.

      --
      Yucca, http://www.cs.tut.fi/~jkorpela/
      Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

      Comment

      • Dennis M. Straussfogel

        #4
        Re: &quot;BR&quo t; tag equivalent in XHTML Strict?

        In article <87a762e1.04012 21506.5a8afef9@ posting.google. com>,
        mmkhajah@syr.ed u (Mohammd M. Hussain) wrote:[color=blue]
        >
        > I am writing an XHTML 1.0 Strict Compatible web page. However, the
        > validator complained about the <br> tag. I wonder whether there is
        > another alternative for this.
        >[/color]

        I think XHTML requires a closing space-slash, as in: <br />

        Dennis M. Straussfogel, Ph.D.
        Aerospace Engineering Consultant

        Comment

        • Neal

          #5
          Re: &quot;BR&quo t; tag equivalent in XHTML Strict?

          On Thu, 22 Jan 2004 23:30:07 +0000, David Dorward <dorward@yahoo. com>
          wrote:
          [color=blue]
          > Mohammd M. Hussain wrote:[color=green]
          >> I am writing an XHTML 1.0 Strict Compatible web page. However, the
          >> validator complained about the <br> tag. I wonder whether there is
          >> another alternative for this.[/color]
          >
          > http://www.w3.org/TR/xhtml1/#h-4.6
          >
          > However - in most cases, when people use <br> then either mean <li> or
          > margin-bottom: 1em; (or larger).
          >
          > Why are you using XHTML anyway? http://www.hixie.ch/advocacy/xhtml
          >[/color]


          Opera doesn't know what to do with that .htm page. Author might as well
          have called it a text file, as it is decidedly NOT an HTML file. Text is
          cut off once the <script> is mentioned in the text, for obvious reasons.

          You'll pardon me if I'm reluctant to take advice from someone who can't
          even make the page display.

          Comment

          • Neal

            #6
            Re: &quot;BR&quo t; tag equivalent in XHTML Strict?

            On Fri, 23 Jan 2004 00:00:18 +0000 (UTC), Jukka K. Korpela
            <jkorpela@cs.tu t.fi> wrote:
            [color=blue]
            > mmkhajah@syr.ed u (Mohammd M. Hussain) wrote:
            >[color=green]
            >> I am writing an XHTML 1.0 Strict Compatible web page. However, the
            >> validator complained about the <br> tag.[/color]
            >
            > Then it had a reason to that. You asked it to check the syntax of your
            > document against a formal definition that you refer to. And it did
            > exactly that. If you are puzzled, that's because you don't know the
            > formal definition that you referred to.
            >
            > There's formally nothing wrong with the <br> tag in XHTML 1.0 Strict
            > per se. It's the context where you use it that matters. And you gave no
            > hint of that, such as a URL.
            >[color=green]
            >> I wonder whether there is
            >> another alternative for this.[/color]
            >
            > The markup you use should depend on the logical structure of your
            > document, which you haven't described at all.
            >[/color]

            If you require a line break, you use the XML empty tag which has a slash
            before the closing angled bracket. So it's <br/> and <img/> and <link/>.
            Of course, it's recommended to use a blank space before that slash in case
            an older browser is tripped up, so <br /> and <img /> and <link /> is
            what's recommended.

            Advise OP read http://www.w3.org/TR/xhtml1/

            Comment

            • Brian

              #7
              Re: &quot;BR&quo t; tag equivalent in XHTML Strict?

              Neal wrote:[color=blue]
              > David Dorward <dorward@yahoo. com> wrote:
              >[color=green]
              >> http://www.hixie.ch/advocacy/xhtml[/color]
              >
              > Opera doesn't know what to do with that .htm page. Author might as
              > well have called it a text file, as it is decidedly NOT an HTML
              > file.[/color]

              Author *did* call it a text file, via the headers, which advertise its
              content type as text/plain.
              [color=blue]
              > Text is cut off once the <script> is mentioned in the text, for
              > obvious reasons.[/color]

              It's not obvious to me. Care to explain?
              [color=blue]
              > You'll pardon me if I'm reluctant to take advice from someone who
              > can't even make the page display.[/color]

              I suspect something might be wrong on the reading end.

              --
              Brian (follow directions in my address to email me)


              Comment

              • Neal

                #8
                Re: &quot;BR&quo t; tag equivalent in XHTML Strict?

                On Fri, 23 Jan 2004 01:46:17 GMT, Brian
                <usenet2@juliet remblay.com.inv alid-remove-this-part> wrote:
                [color=blue]
                > Author *did* call it a text file, via the headers, which advertise its
                > content type as text/plain.[/color]
                ....[color=blue]
                > I suspect something might be wrong on the reading end.
                >[/color]

                My apologies. Opera cannot parse it, yet Mozilla and even IE can. Must be
                a bug in Opera.

                Comment

                • Mohammd M. Hussain

                  #9
                  Re: &quot;BR&quo t; tag equivalent in XHTML Strict?

                  Thanks for the reply,

                  Actually what I'm writing is a server side Perl script that generates
                  XHTML 1.0 Strict compatible documents. I am well aware of the rules of
                  XHTML 1.0 Strict and my document 99% conforms with them ( thanks to
                  CSS ) except for those <br /> tags.

                  This is a sample code:
                  ----------------------
                  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
                  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
                  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
                  <head>
                  <title>SKIN.p m Test OK</title>
                  <meta http-equiv="Content-Type" content="text/html;
                  charset=windows-1252" />

                  <link rel="stylesheet " type="text/css" href="style.css " />
                  </head>
                  <body>
                  <table class="navTable ">
                  <tr>
                  <td class="tableHea der">SKIN.pm Test OK</td>
                  </tr>
                  <tr>
                  <td class="alt1">[ <a href="http://localhost/mxGuest/main.cgi">View
                  Comments</a> &#124; <a href="http://localhost/mxGuest/post.cgi">Add a
                  New Comment</a> ]</td>
                  </tr>
                  </table>
                  <hr />
                  <br />

                  <table class="msgTable ">
                  <tr>
                  <td class="tableHea der">SKIN.pm Test OK</td>
                  </tr>
                  <tr>
                  <td class="alt1">Te st OK!</td>
                  </tr>
                  </table>

                  <br />
                  <hr />
                  <div class="copyrigh t">Copyright (c) 2004</div>
                  </body>
                  </html>

                  Comment

                  • DU

                    #10
                    Re: &quot;BR&quo t; tag equivalent in XHTML Strict?

                    Mohammd M. Hussain wrote:
                    [color=blue]
                    > Thanks for the reply,
                    >
                    > Actually what I'm writing is a server side Perl script that generates
                    > XHTML 1.0 Strict compatible documents. I am well aware of the rules of
                    > XHTML 1.0 Strict and my document 99% conforms with them ( thanks to
                    > CSS ) except for those <br /> tags.
                    >
                    > This is a sample code:
                    > ----------------------
                    > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
                    > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
                    > <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
                    > <head>
                    > <title>SKIN.p m Test OK</title>
                    > <meta http-equiv="Content-Type" content="text/html;
                    > charset=windows-1252" />
                    >
                    > <link rel="stylesheet " type="text/css" href="style.css " />
                    > </head>
                    > <body>
                    > <table class="navTable ">
                    > <tr>
                    > <td class="tableHea der">SKIN.pm Test OK</td>
                    > </tr>
                    > <tr>
                    > <td class="alt1">[ <a href="http://localhost/mxGuest/main.cgi">View
                    > Comments</a> &#124; <a href="http://localhost/mxGuest/post.cgi">Add a
                    > New Comment</a> ]</td>
                    > </tr>
                    > </table>
                    > <hr />
                    > <br />
                    >
                    > <table class="msgTable ">
                    > <tr>
                    > <td class="tableHea der">SKIN.pm Test OK</td>
                    > </tr>
                    > <tr>
                    > <td class="alt1">Te st OK!</td>
                    > </tr>
                    > </table>
                    >
                    > <br />
                    > <hr />
                    > <div class="copyrigh t">Copyright (c) 2004</div>
                    > </body>
                    > </html>[/color]


                    2 comments.
                    1- You're using tables for non-tabular data. This is not recommendable
                    for various reasons that I won't detail here.
                    2- You don't need to include a <br />; you just have to declare a
                    margin-bottom for your table if you want the horizontal rule to be cleared.

                    DU

                    Comment

                    • Jukka K. Korpela

                      #11
                      Re: &quot;BR&quo t; tag equivalent in XHTML Strict?

                      Neal <neal413@spamrc n.com> wrote:
                      [color=blue]
                      > Opera cannot parse it, yet Mozilla and even IE can. Must be
                      > a bug in Opera.[/color]

                      Actually, Opera does not get the _media type_ of

                      right. It's clearly declared as text/plain, yet Opera treats it as
                      text/html - even claiming that the server send that type. But maybe I'm
                      missing something - maybe the server actually sends a different
                      Content-Type header to Opera.

                      It's a bug that Opera _parses_ it. It has been told to treat the data
                      as plain text. It should simply make it available to the user as plain
                      text, typically displaying it literally as written, preserving the line
                      structure and all.

                      --
                      Yucca, http://www.cs.tut.fi/~jkorpela/
                      Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

                      Comment

                      • Jukka K. Korpela

                        #12
                        Re: &quot;BR&quo t; tag equivalent in XHTML Strict?

                        DU <drunclear@hotW IPETHISmail.com > wrote:
                        [color=blue]
                        > 2- You don't need to include a <br />; you just have to declare a
                        > margin-bottom for your table if you want the horizontal rule to be
                        > cleared.[/color]

                        That's a good practical advice. Using CSS is more flexible. Besides,
                        there's really no guarantee that <br /> causes the empty space that the
                        author wants. What does it mean to break a line immediately after a
                        table? Can you break something that really doesn't exist? Browsers may
                        behave as if there were an empty line between the table element and the
                        br element, but why would we count on such (mis)behavior?

                        But the _validator_ message is caused by the fact that <br /> is an
                        inline element, which means that it is not allowed as a direct sub-
                        element, or "child", of the body element. In Strict DTD, all inline
                        elements inside body must be somehow wrapped into block-level elements.
                        Formally, this would be satisfied by making it
                        <div><br /></div>
                        but this actually emphasizes how illogical it is to try to create empty
                        space by using <br />.

                        --
                        Yucca, http://www.cs.tut.fi/~jkorpela/
                        Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

                        Comment

                        • Steve Pugh

                          #13
                          Re: &quot;BR&quo t; tag equivalent in XHTML Strict?

                          "Jukka K. Korpela" <jkorpela@cs.tu t.fi> wrote:[color=blue]
                          >Neal <neal413@spamrc n.com> wrote:
                          >[color=green]
                          >> Opera cannot parse it, yet Mozilla and even IE can. Must be
                          >> a bug in Opera.[/color]
                          >
                          >Actually, Opera does not get the _media type_ of
                          >http://www.hixie.ch/advocacy/xhtml
                          >right. It's clearly declared as text/plain, yet Opera treats it as
                          >text/html - even claiming that the server send that type. But maybe I'm
                          >missing something - maybe the server actually sends a different
                          >Content-Type header to Opera.
                          >
                          >It's a bug that Opera _parses_ it. It has been told to treat the data
                          >as plain text. It should simply make it available to the user as plain
                          >text, typically displaying it literally as written, preserving the line
                          >structure and all.[/color]

                          Odd, no problems at all here with Opera 7.23.

                          Which versions are giving problems and what are the user preferences
                          with regards to trusting server mime-types set to?

                          Steve

                          --
                          "My theories appal you, my heresies outrage you,
                          I never answer letters and you don't like my tie." - The Doctor

                          Steve Pugh <steve@pugh.net > <http://steve.pugh.net/>

                          Comment

                          • Jukka K. Korpela

                            #14
                            Opera's Content-Type bug

                            Under Subject: Re: "BR" tag equivalent in XHTML Strict?
                            Steve Pugh <steve@pugh.net > wrote:
                            [color=blue]
                            > "Jukka K. Korpela" <jkorpela@cs.tu t.fi> wrote:[color=green]
                            >>Neal <neal413@spamrc n.com> wrote:
                            >>[color=darkred]
                            >>> Opera cannot parse it, yet Mozilla and even IE can. Must be a
                            >>> bug in Opera.[/color]
                            >>
                            >>Actually, Opera does not get the _media type_ of
                            >>http://www.hixie.ch/advocacy/xhtml right. It's clearly declared as
                            >>text/plain, yet Opera treats it as text/html - even claiming that
                            >>the server send that type. But maybe I'm missing something - maybe
                            >>the server actually sends a different Content-Type header to Opera.
                            >>
                            >>It's a bug that Opera _parses_ it. It has been told to treat the
                            >>data as plain text. It should simply make it available to the user
                            >>as plain text, typically displaying it literally as written,
                            >>preserving the line structure and all.[/color]
                            >
                            > Odd, no problems at all here with Opera 7.23.[/color]

                            I'm using 7.23 too.
                            [color=blue]
                            > Which versions are giving problems and what are the user
                            > preferences with regards to trusting server mime-types set to?[/color]

                            Oh my. I don't think I have changed those settings, and they indeed
                            seem to say that Opera makes its own guesses if it thinks that the Mime
                            type is not "trustworth y". I don't know what the English version says,
                            but I suppose the Finnish version is a technically correct translation.
                            And the sidebar really claims that the MIME type from server is
                            text/html. If I change the setting (in file type association window),
                            then it correctly reports the type as text/plain and displays the data
                            "as is".

                            Thus the default is protocol-incorrect behavior, unless I'm missing
                            something. Moreover, the browser incorrectly claims that its guess is
                            what the server actually sent. And the dialogue for changing the
                            behavior is very misleading. There's no reason whatsoever to regard the
                            Mime type as not trustworthy just because a browser "thinks" it can
                            deduce the type better from the URL or the actual data. Treating a
                            resource as text/html just because it has no "suffix" is absurd too.

                            I'm afraid Opera is making great progress in imitating some of the
                            worst intentional errors of IE.

                            Moving the discussion to the relevant browsers group now.

                            --
                            Yucca, http://www.cs.tut.fi/~jkorpela/
                            Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

                            Comment

                            • Alan J. Flavell

                              #15
                              Re: Opera's Content-Type bug

                              On Fri, 23 Jan 2004, Jukka K. Korpela wrote:

                              [re. Opera's response to text/plain]
                              [color=blue]
                              > Thus the default is protocol-incorrect behavior,[/color]

                              Unfortunately, it is. Opera seems to have decided in favour of
                              emulating IE's HTTP protocol violation by default, and only conforming
                              to this mandatory requirement of RFC2616 for those users who had
                              enough technical knowledge to reconfigure the preferences for
                              protocol-correct behaviour.
                              [color=blue]
                              > Moreover, the browser incorrectly claims that its guess is
                              > what the server actually sent.[/color]

                              That's doubly-unfortunate.

                              I would - just about - be prepared to accept a browser dialog which
                              informed the user that the server-provided content type appeared to be
                              broken, and invited them to take their own decision on whether it
                              should be fixed.

                              But modifying the content-type by stealth in the client is forbidden
                              by RFC2616, and since this is potentially a security exposure, the
                              disregard of such a mandatory requirement is inadmissible IMHO.
                              [color=blue]
                              > And the dialogue for changing the behavior is very misleading.
                              > There's no reason whatsoever to regard the Mime type as not
                              > trustworthy[/color]

                              In theory, there isn't; but in practice it's known that many (most?)
                              servers will serve-out unknown content as text/plain, which is
                              doubtless why IE decided to establish the entirely incorrect and
                              impermissible assumption that conversely, text/plain means "client may
                              guess". But there is another RFC which defines the meaning of
                              text/plain - see e.g:



                              which I would say puts the matter beyond dispute.

                              Historical digression:

                              It would have been better for all concerned if the principle had been
                              established that servers sent out all unknown content types as
                              application/octet-stream, and then it would have been permissible for
                              clients to establish the convention that octet-stream uniquely means
                              "client may guess" - but for security reasons I would still have
                              wanted the client software to dialog with the user before taking any
                              action on the result of that guess.
                              [color=blue]
                              > I'm afraid Opera is making great progress in imitating some of the
                              > worst intentional errors of IE.
                              >
                              > Moving the discussion to the relevant browsers group now.[/color]

                              I see that you set f'ups to ms-windows: but is this behaviour unique
                              to Opera's MS-Windows implementations ? I haven't tried others myself,
                              but I'd expect them to behave similarly, no? Maybe this should be
                              broadened to ...browsers.mis c, depending on the answer to that
                              question. (Note temporary addition of x-post, f'ups).

                              Comment

                              Working...