Ending Tag Format Causes Problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Tony LaPaso

    Ending Tag Format Causes Problem

    Hi all,

    I'm not sure if this is an HTML issue or CSS issue but it's weird.

    I've been working w/XML for 5+ years and it's always been true that you
    can use a shorthand notation for an empty element like this:

    "<fred/>" is the same as "<fred></fred>"


    Well, I'm seeing a case where this is not true. Take a look at the
    following two examples, if you would:


    <div class='separato rBar'></div><p>hello</p>
    <hr/>
    <div class='separato rBar'/><p>hello</p>
    <hr/>


    These should be equivalent, right? It seems they are not. Firefox
    v1.0.4 renders the two differently, as do IE 6 and Opera.

    Here is the 'separatorBar' definition:

    <style type='text/css'>
    div.separatorBa r {
    margin-left:-10px;
    margin-right: -10px;
    border:solid;
    }
    </style>


    What have I missed here? I though the <xxx/> notation was a shorthand
    for <xxx></xxx>. Is this not true> Does anyone have an explanation for
    my examples above?

    Thanks.

    --
    Tony LaPaso




  • Alan J. Flavell

    #2
    Re: Ending Tag Format Causes Problem

    On Fri, 13 May 2005, Tony LaPaso wrote:
    [color=blue]
    > I'm not sure if this is an HTML issue or CSS issue but it's weird.[/color]

    I don't think so. It appears you're failing to comform with Appendix
    C of the XHTML/1.0 specification, that's all. Nothing "weird" about
    that.

    Comment

    • Jukka K. Korpela

      #3
      Re: Ending Tag Format Causes Problem

      "Tony LaPaso" <tlapaso@comcas t.net> wrote:
      [color=blue]
      > I'm not sure if this is an HTML issue or CSS issue but it's weird.[/color]

      It's basically an HTML issue; f'ups set accordingly.
      [color=blue]
      > I've been working w/XML for 5+ years and it's always been true that
      > you can use a shorthand notation for an empty element like this:
      >
      > "<fred/>" is the same as "<fred></fred>"[/color]

      It's been true all the time and it still is true that the XMLized
      version of HTML, called XHTML, which is what you are really trying to
      use, is not ready for Web use. At least not without the precaution of
      fooling IE & Co. into seeing it as old HTML, by applying Appendix C.

      (If you don't know what Appendix C means, you haven't been paying
      attention when you've read c.i.w.a.h. or your XHTML primer - or you
      found a very poor primer.)
      [color=blue]
      > <div class='separato rBar'></div><p>hello</p>
      > <hr/>
      > <div class='separato rBar'/><p>hello</p>
      > <hr/>
      >
      > These should be equivalent, right?[/color]

      They are equivalent by XML specification. The same specification tells
      you should not use "self-closing" tags except for elements with EMPTY
      declared content, when "interoperabili ty" matters, and on the Web it
      surely does. Ref.:


      On the other hand, an empty div element is almost always a symptom of
      bad design, and the class name virtually confirms this.

      --
      Yucca, http://www.cs.tut.fi/~jkorpela/

      Comment

      • Tony LaPaso

        #4
        Re: Ending Tag Format Causes Problem

        Okay, okay...I changed <div class='separato rBar'/> to <div
        class='separato rBar' /> but there's no change in behavior. This issue
        about a space before the "/>" is a 1999 issue. I can't believe the
        latest version of Firefox needs that space. What's more, *both* IE and
        Firefox are rendering differently based on whether or not I use <.../>
        vs. <...></...>. Both browsers are consistent in this respect.

        As usual, I should have been more explicit. I'm using (trying to use)
        XHTML 1.0 Strict. Here's the DTD I'm using: <!DOCTYPE html PUBLIC
        "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">

        I'm not using the xml prolog so IE 6 is not in "quirks mode".

        Actually, forget about IE 6 -- it's hopelessly out of date from a
        standards perspective. I am concerned about the way Firefox is
        rendering it. Firefox seems to generally be pretty standards compliant.

        So, still I get the same behavior. Is there something special in
        Appendix C I'm missing?

        BTW, what is "f'ups" and "c.i.w.a.h" mean?

        --
        Tony LaPaso


        "Jukka K. Korpela" <jkorpela@cs.tu t.fi> wrote in message
        news:Xns9656636 BE54jkorpelacst utfi@193.229.0. 31...[color=blue]
        > "Tony LaPaso" <tlapaso@comcas t.net> wrote:
        >[color=green]
        >> I'm not sure if this is an HTML issue or CSS issue but it's weird.[/color]
        >
        > It's basically an HTML issue; f'ups set accordingly.
        >[color=green]
        >> I've been working w/XML for 5+ years and it's always been true that
        >> you can use a shorthand notation for an empty element like this:
        >>
        >> "<fred/>" is the same as "<fred></fred>"[/color]
        >
        > It's been true all the time and it still is true that the XMLized
        > version of HTML, called XHTML, which is what you are really trying to
        > use, is not ready for Web use. At least not without the precaution of
        > fooling IE & Co. into seeing it as old HTML, by applying Appendix C.
        >
        > (If you don't know what Appendix C means, you haven't been paying
        > attention when you've read c.i.w.a.h. or your XHTML primer - or you
        > found a very poor primer.)
        >[color=green]
        >> <div class='separato rBar'></div><p>hello</p>
        >> <hr/>
        >> <div class='separato rBar'/><p>hello</p>
        >> <hr/>
        >>
        >> These should be equivalent, right?[/color]
        >
        > They are equivalent by XML specification. The same specification
        > tells
        > you should not use "self-closing" tags except for elements with EMPTY
        > declared content, when "interoperabili ty" matters, and on the Web it
        > surely does. Ref.:
        > http://www.w3.org/TR/REC-xml/#sec-starttags
        >
        > On the other hand, an empty div element is almost always a symptom of
        > bad design, and the class name virtually confirms this.
        >
        > --
        > Yucca, http://www.cs.tut.fi/~jkorpela/[/color]


        Comment

        • Richard Cornford

          #5
          Re: Ending Tag Format Causes Problem

          Tony LaPaso wrote:
          <snip>[color=blue]
          > So, still I get the same behavior. Is there something
          > special in Appendix C I'm missing?[/color]
          <snip>

          Probably the most important aspect of Appendix C is that you send
          Appendix C documents with a content type header of 'text/html' (or
          possibly do content negotiation and only send text/html as the content
          type for browsers that don't admit to understanding XHTML).

          A browser receiving a document with a content type header asserting that
          the contents are text/html will interpret that document as HTML (what
          else could they do?). Appendix C relies on the content being interpreted
          as tag soup HTML with syntax that is within the known error-correction
          behaviour of existing browsers. Thus the browser error-corrects the
          document back to HTML, and creates an HTML DOM for it.

          In HTML there is no shorthand, and that penultimate slash in a tag is
          interpreted as an error in the mark-up, which is just ignored (not
          strictly correct, but that is what happens). Thus <div /> becomes an
          opening div tag for which there is no corresponding closing div tag. The
          corresponding closing div tag will probably be inferred by the browser
          in a position just before the containing element is closed.

          Richard.


          Comment

          • Eric B. Bednarz

            #6
            Re: Ending Tag Format Causes Problem

            "Tony LaPaso" <tlapaso@comcas t.net> writes:
            [color=blue]
            > Okay, okay...I changed <div class='separato rBar'/> to <div
            > class='separato rBar' /> but there's no change in behavior. This issue
            > about a space before the "/>" is a 1999 issue.[/color]

            Prince had a 1999 issue I seem to recollect.
            Compatibility apart, you have already been told why you shouldn't do
            that in the first place...
            [color=blue]
            > I can't believe the
            > latest version of Firefox needs that space. What's more, *both* IE and
            > Firefox are rendering differently based on whether or not I use <.../>
            > vs. <...></...>. Both browsers are consistent in this respect.[/color]

            ....but since you are obviously advertising text/html anything that
            happens is a feature.
            [color=blue]
            > As usual, I should have been more explicit. I'm using (trying to use)
            > XHTML 1.0 Strict. Here's the DTD I'm using: <!DOCTYPE html PUBLIC
            > "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
            >
            > I'm not using the xml prolog so IE 6 is not in "quirks mode".[/color]

            You just quoted (part or all of) the prolog; you could spare yourself
            some quality time if you locate and read the specs right away instead of
            of getting confused by helpful misinformation (webstandards.o rg and
            such) first.
            [color=blue]
            > BTW, what is "f'ups" and "c.i.w.a.h" mean?[/color]

            Since I'm replying to this in a 'c.i.w.a.s.', it means you need to
            install a newsreader to participate on Usenet.


            --
            | ) Più Cabernet,
            -( meno Internet.
            | ) http://bednarz.nl/

            Comment

            • Tony LaPaso

              #7
              Re: Ending Tag Format Causes Problem

              Thank you all... I changed the content type to application/xhtml+xml
              and Firefox rendered it like a charm!

              I'm a little new to CSS and trying to get my site up to standards and
              so some of my questions might seem a little simple. But thank you all
              for responding.


              --
              Tony LaPaso




              "Tony LaPaso" <tlapaso@comcas t.net> wrote in message
              news:6rmdncNMBq jojxjfRVn-qg@comcast.com. ..[color=blue]
              > Hi all,
              >
              > I'm not sure if this is an HTML issue or CSS issue but it's weird.
              >
              > I've been working w/XML for 5+ years and it's always been true that
              > you can use a shorthand notation for an empty element like this:
              >
              > "<fred/>" is the same as "<fred></fred>"
              >
              >
              > Well, I'm seeing a case where this is not true. Take a look at the
              > following two examples, if you would:
              >
              >
              > <div class='separato rBar'></div><p>hello</p>
              > <hr/>
              > <div class='separato rBar'/><p>hello</p>
              > <hr/>
              >
              >
              > These should be equivalent, right? It seems they are not. Firefox
              > v1.0.4 renders the two differently, as do IE 6 and Opera.
              >
              > Here is the 'separatorBar' definition:
              >
              > <style type='text/css'>
              > div.separatorBa r {
              > margin-left:-10px;
              > margin-right: -10px;
              > border:solid;
              > }
              > </style>
              >
              >
              > What have I missed here? I though the <xxx/> notation was a shorthand
              > for <xxx></xxx>. Is this not true> Does anyone have an explanation
              > for my examples above?
              >
              > Thanks.
              >
              > --
              > Tony LaPaso
              >
              >
              >
              >[/color]


              Comment

              Working...