<p> and <div> and breaks

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Gus Richter

    #16
    Re: &lt;p&gt; and &lt;div&gt; and breaks

    Jukka K. Korpela wrote:
    Scripsit Gus Richter:
    >
    >I see the use of typical as "among all available" browsers and not of
    >"all" browsers in use out there.
    >
    I see "typical" as meaning common, usual, or characteristic.
    Right, and among all the "different" browsers. Really ridiculous to mean
    the total volume of all browsers in use, other than to just be
    argumentative.
    >>There's no law against a browser having a default style sheet like
    >>p { margin: 1.3em 0 0 0; }
    >>
    >But then it would not follow the "Double Line Leading" convention for
    >paragraphs.
    >
    So what? That convention is bad style anyway ("engineer's paragraphs"),
    and, what matters here, just a convention, not part of HTML (or CSS)
    specifications.
    I happen to not like the Double Line Leading convention for paragraphs,
    but it is here and encouraged by W3C. Don't ask for proof for I won't
    bother to search for it. You know that this is so.

    Your rule for top-margin only as a default for paragraphs would confuse
    a document and is truly grasping for argumentative straws.
    >The subject in the specification is regarding a DIV being on a "New
    >Line" and the method used by the browsers is the placing of
    >line breaks before and after DIVs. Example markup is presented and how
    >it will be rendered.
    >
    No, how it is _typically_ rendered.
    You are predictable. I left it out on purpose for you.
    >Whether it is an error or whatever due to
    >carelessness , it is wrong.
    >
    No, it contains line breaks just where the text says they are. Whether
    it also contains vertical spacing is a different issue. And they made a
    mistake in confusing the two.
    I say that it is an error and that it is wrong. You say No, but hedge
    your bet by adding at the end that they made a mistake. It seems to me
    that it is you that is confusing the two issues. Vertical spacing is the
    issue in this thread as demonstrated in an example where the issue is
    about line breaks.

    In an example of rendering for line breaks, the example also shows
    vertical spacing as "Double Line Leading" in one instance, but not in
    the other instance. Perhaps they should have used a different example,
    but they didn't and by indicating that it is a typical browser rendering
    is wrong, an error and a mistake.

    --
    Gus

    Comment

    • Lars Eighner

      #17
      Re: &lt;p&gt; and &lt;div&gt; and breaks

      In our last episode,
      <7ooio2tstkcjhh 0daimru6870plkc 2dfcn@4ax.com>,
      the lovely and talented Kent Feiler
      broadcast on comp.infosystem s.www.authoring.html:
      On Tue, 19 Dec 2006 14:09:48 -0600, Kent Feiler <zzzz@zzzz.comw rote:
      1. Here's some html from a W3C recommendations page.
      <P>aaaaaaaaa<DI V>bbbbbbbbb</DIV><DIV>cccccc cc<P>dddddddd</DIV>
      ------------------------------------------------------------------------------
      I have to say that this newsgroup seems to have a higher percentage of
      obnoxious creeps who post to it than most. But maybe I should check
      out some of the religious newgroups, it may turn out that everyone
      here is really quite polite and courteous!
      When you have not made the least effort to learn HTML, what do you expect?
      To begin, I was curious as to: (1)why this snippet of html wasn't
      producing the results I thought it would, and (2)why IE7 and FF2 were
      producing different results. In the end, the answer to (2) is the
      usual, "That's the way it is, sukka. Suffer!"
      There are plenty of headaches when browsers do not interpret styles the same
      way. That they have different defaults for unstyled elements is not really
      a problem.
      But I'm still confused about (1). Where does the first <pend?
      Since P cannot contain a block element and DIV is a block element,
      P is closed when the first DIV is opened.
      For FF2 it appears to end at the first <div>, but why?
      As you would know if you had ever looked at a spec, P cannot contain
      a block element. The browser assumes you must have meant to close
      P when you opened DIV, because DIV in P is impossible.
      Is it because of a syntax error,
      It isn't really a syntax error in HTML. In HTML many elements do not
      require closing tags. If you are thinking you are putting a DIV in P,
      you are just wrong, but <Pblah, blah, blah. <DIVis not incorrect syntax.
      It is just syntax that doesn't mean what you think it does.
      i.e. <div>s are not allowed within <pso
      FF terminates the first <pwith the normal double break and then
      continues processing?
      Thinking about "double breaks" is misleading. A browser could reasonably
      have a default that puts a single break when P closes and and a break with
      an indent when P opens. It is not about how browsers choose to render
      paragraphs. It is about the structure of the document.
      IE7 looks like it doesn't end the first <puntil it hits the second
      one and processes the two internal <div>s with a single break. I would
      have thought it would discard the syntactically invalid <divtags and
      produce something like:
      The <DIV>s are not syntactically incorrect (in HTML). They just do
      not mean what you think they do.
      aaaaaaaaaabbbbb bbbbbcccccccccc
      dddddddddd
      ...but instead it seems to ignore the idea the <div>s aren't allowed
      within <p>s. Maybe it didn't attend the meeting. Or maybe it doesn't
      think it should be in the business of enforcing syntax errors.
      If IE doesn't assume P is closed when DIV opens, it is wrong.
      Does that sound like what's happening?

      --
      Lars Eighner <http://larseighner.com/ <http://myspace.com/larseighner>
      Consider what might be fertilizing the greener grass across the fence.

      Comment

      • Kent Feiler

        #18
        Re: &lt;p&gt; and &lt;div&gt; and breaks

        On 20 Dec 2006 22:42:25 GMT, Lars Eighner <usenet@larseig hner.com>
        wrote:

        In our last episode,
        <7ooio2tstkcjhh 0daimru6870plkc 2dfcn@4ax.com>,
        the lovely and talented Kent Feiler
        broadcast on comp.infosystem s.www.authoring.html:
        On Tue, 19 Dec 2006 14:09:48 -0600, Kent Feiler <zzzz@zzzz.co m>
        wrote:
        1. Here's some html from a W3C recommendations page.
        <P>aaaaaaaaa<DI V>bbbbbbbbb</DIV><DIV>cccccc cc<P>dddddddd</DIV>
        >
        ------------------------------------------------------------------------------
        I have to say that this newsgroup seems to have a higher percentage
        of obnoxious creeps who post to it than most. But maybe I should
        check out some of the religious newgroups, it may turn out that
        everyone here is really quite polite and courteous!
        ----------------------------------------------------------------------
        When you have not made the least effort to learn HTML, what do you
        expect?


        I rest my case.



        Regards,


        Kent Feiler

        Comment

        • Toby Inkster

          #19
          Re: &lt;p&gt; and &lt;div&gt; and breaks

          Kent Feiler wrote:
          It looks like in IE7 a <pCAN contain a <divwhich accounts for the
          difference between #1 and #2 when we add the </p>s. The <pin #1
          probably doesn't end until it hits the second <p>.
          I'm never surprised by IE getting things wrong.

          Firefox is right, and is consistant with the W3C Recommendation, as is
          Opera, Safari and iCab. IE 5 for Mac gets things right too.

          --
          Toby A Inkster BSc (Hons) ARCS
          Contact Me ~ http://tobyinkster.co.uk/contact

          Comment

          • maxonline.sabeen@gmail.com

            #20
            Free Website Designing solution.

            Welcome to MAX web Solution's Website, a full service affordable
            offshore web site design, Search Engine marketing and web development
            company based in Kathmandu. We focus on e business solutions at low
            prices serving the needs of small to medium businesses all over the
            world. We offer a wide range of custom web site design development and
            seo services at affordable prices starting from small presentation
            sites to complex multifunctional web portals and advanced custom
            e-commerce business solutions.
            Service is everything - your satisfaction is guaranteed
            That is why we would gladly accept the responsibility of taking care of
            your site. We want to save your time, so that you could devote yourself
            to the most important thing - your business. Allow us to maintain and
            support your web site.
            Money back guarantee
            A 30 Day money back guarantee for the first monthly fee.
            You can also response to this message.

            Fillup the below information for further inquarry.
            Contact Name :
            Organization Name:
            E-mail Address :
            Phone no:
            Call us for Demostration
            Call : 2390177 / 9841206820
            Check it out for more information


            Comment

            • Andy Mabbett

              #21
              Re: &lt;p&gt; and &lt;div&gt; and breaks

              In message <1NmdnQ-lYY9TGhTYnZ2dnU VZ_rGinZ2d@gold en.net>, Gus Richter
              <gusrichter@net scape.netwrites
              >Don't ask for proof for I won't bother to search for it. You know that
              >this is so.
              Yup, that's convinced me.

              --
              Andy Mabbett
              * Say "NO!" to compulsory ID Cards: <http://www.no2id.net/>
              * Free Our Data: <http://www.freeourdata .org.uk>
              * Are you using Microformats, yet: <http://microformats.or g/?

              Comment

              • Andy Mabbett

                #22
                Re: &lt;p&gt; and &lt;div&gt; and breaks

                In message <v30ko2t2dl4chr jo9rktfg8fnflg3 847og@4ax.com>, Kent Feiler
                <zzzz@zzzz.comw rites
                >I have to say that this newsgroup seems to have a higher percentage
                >of obnoxious creeps who post to it than most. But maybe I should
                >check out some of the religious newgroups, it may turn out that
                >everyone here is really quite polite and courteous!
                >----------------------------------------------------------------------
                >When you have not made the least effort to learn HTML, what do you
                >expect?
                >
                >
                >I rest my case.
                It clearly hasn't occurred to you that many people might regard someone
                who comes in, demanding answers to questions which they can easily find
                on-line, and then complaining when they're given helpful answers anyway,
                as impolite and discourteous, or even as an obnoxious creep.

                --
                Andy Mabbett
                * Say "NO!" to compulsory ID Cards: <http://www.no2id.net/>
                * Free Our Data: <http://www.freeourdata .org.uk>
                * Are you using Microformats, yet: <http://microformats.or g/?

                Comment

                • Kent Feiler

                  #23
                  Re: &lt;p&gt; and &lt;div&gt; and breaks

                  On Wed, 20 Dec 2006 18:50:27 +0000 (UTC), Darin McGrew
                  <mcgrew@stanfor dalumni.orgwrot e:

                  Kent Feiler <zzzz@zzzz.comw rote:
                  <P>aaaaaaaaa<DI V>bbbbbbbbb</DIV><DIV>cccccc cc<P>dddddddd</DIV>
                  In http://www.w3.org/TR/REC-html40/stru...l.html#h-7.5.4 the
                  example
                  is actually

                  <P>aaaaaaaaa<DI V>bbbbbbbbb</DIV><DIV>ccccc< P>ccccc</DIV>

                  but I like your version better.

                  There is no syntax error in the HTML. Since DIV elements are not
                  allowed inside P elements, and since the closing </Ptag is optional,
                  the closing of the P element is implied by the opening of the DIV
                  element.
                  ---------------------------------------------------------------------

                  I apoligize for dragging this out. I understand that DIV elements are
                  not allowed inside P elements and I understand that the closing </p>
                  tag is optional, but unless it's somewhere stated what a browser
                  should DO when it finds a DIV that appears to be intended to be inside
                  a P, it seems like a browser-philosopy issue. Should the browser
                  assume that the html writer just forgot to insert the </pbefore the
                  <divand put one in for him, or should it assume that the html writer
                  didn't know that <div>s weren't allowed within <p>s and forget about
                  the W3C recomendation? On the third hand, if a browser really wants to
                  enforce the W3C recomendation maybe it should discard the two <div>s.

                  In the end, the browser is just trying to make a sensible screen out
                  of whatever piece of html crap is presented to it. I'd vote for the FF
                  method, but I have some sympathy for the IE idea, that may be what the
                  html writer really intended.


                  Regards,


                  Kent Feiler

                  Comment

                  • Lars Eighner

                    #24
                    Re: &lt;p&gt; and &lt;div&gt; and breaks

                    <lidjp2lsk8ja3r 7us283eopf5l0ih 3ipur@4ax.com>,
                    the lovely and talented Kent Feiler
                    broadcast on comp.infosystem s.www.authoring.html:
                    I apoligize for dragging this out. I understand that DIV elements are
                    not allowed inside P elements and I understand that the closing </p>
                    tag is optional, but unless it's somewhere stated what a browser
                    should DO when it finds a DIV that appears to be intended to be inside
                    a P, it seems like a browser-philosopy issue.
                    How could the browser possibly judge that that a DIV "appears to be intended
                    to be inside a P"?
                    Should the browser assume that the html writer just forgot to insert the
                    </p>
                    The closing tag is *optional*. Many authors know the rules and simple don't
                    waste the keystrokes to put in the optional tags. They did not forget. The
                    knew the rules and expected a conforming browser to abide by them. You seem
                    to be saying that authors who study the rules and know how to use them
                    should have there documents second-guessed because some people just put any
                    old slop on the web and have never looked at a DTD in their lives.

                    before the <divand put one in for him, or should it assume that the html
                    writer didn't know that <div>s weren't allowed within <p>s and forget
                    about the W3C recomendation? On the third hand, if a browser really wants
                    to enforce the W3C recomendation maybe it should discard the two <div>s.
                    Nonsense. This is from the W3C 4.01 spec, a document you still show no sign
                    of having ever read:

                    + A user agent must ensure that rendering is unchanged by the
                    presence or absence of start tags and end tags when the HTML
                    DTD indicates that these are optional. See the section on
                    element definitions for introductory information on SGML
                    elements.

                    See that word "must"? A conforming browser *must* treat:

                    <p>blah blah blah<div>yadda yadda</div>

                    exactly like:

                    <p>blah blah blah</p><div>yadda yadda</div>
                    In the end, the browser is just trying to make a sensible screen out
                    of whatever piece of html crap is presented to it. I'd vote for the FF
                    method, but I have some sympathy for the IE idea, that may be what the
                    html writer really intended.
                    --
                    Lars Eighner <http://larseighner.com/ <http://myspace.com/larseighner>
                    An effective way to deal with predators is to taste terrible.

                    Comment

                    • VK

                      #25
                      Re: &lt;p&gt; and &lt;div&gt; and breaks

                      Kent Feiler wrote:
                      I apoligize for dragging this out. I understand that DIV elements are
                      not allowed inside P elements and I understand that the closing </p>
                      tag is optional, but unless it's somewhere stated what a browser
                      should DO when it finds a DIV that appears to be intended to be inside
                      a P, it seems like a browser-philosopy issue.
                      There is no philosophy here: purely technical aspect plus a leftover of
                      the "HTML childhood". That was explained N times already but let's make
                      N+1th time:
                      >From the very beginning and until relatively recently P element was not
                      a container: it was an element w./o content marking _paragraph break_

                      This way originally in HTML there were paired elements "small" line
                      break BR and "big" paragraph break P. Respectively BR marked the
                      beginning of the next line and P marked the beginning of the next
                      paragraph.

                      When later it was decided to promote P into container the task was do
                      not break millions of already existing pages. The compromise rule was
                      made as simple as moo-cow:

                      New paragraph starts with the opening <Ptag and ends by closing </P>
                      tag or by opening tag of a block element - whatever comes first.

                      I fail to find any "browser philosophy" in here.

                      Comment

                      • Darin McGrew

                        #26
                        Re: &lt;p&gt; and &lt;div&gt; and breaks

                        VK <schools_ring@y ahoo.comwrote:
                        From the very beginning and until relatively recently P element was not
                        a container: it was an element w./o content marking _paragraph break_
                        Do you really consider HTML 2.0 "relatively recently" in the history of
                        HTML? The P element has been a container (with an optional closing tag)
                        since then.
                        --
                        Darin McGrew, mcgrew@stanford alumni.org, http://www.rahul.net/mcgrew/
                        Web Design Group, darin@htmlhelp. com, http://www.HTMLHelp.com/

                        "I'd love to make time, if only I could find the recipe."

                        Comment

                        • VK

                          #27
                          Re: &lt;p&gt; and &lt;div&gt; and breaks

                          Darin McGrew wrote:
                          Do you really consider HTML 2.0 "relatively recently" in the history of
                          HTML? The P element has been a container (with an optional closing tag)
                          since then.
                          This comment is correct: but only from the modern point of view.

                          The time we are talking about RFC HTML specs were of the same public
                          interest as the average density of Jupiter is right now. Besides of a
                          very few extremely curious people around the world - everyone else was
                          reading Netscape specs and testing on the current Netscape release. To
                          the honor of Netscape they stated from the beginning that "despite
                          closing </Ptag has no sense, we encourage you to use it in case of
                          future changes" (by memory quote). But an average developer even at
                          that far time was pretty much the same as it is right now: skip on any
                          keystroke one can skip and to use only absolutely necessary things :-)

                          The first more or less wide interest to HTML standards appeared only
                          closer to the end of Browser Wars when standard/non-standard topic was
                          used as a propaganda tool to fight the rival. By that time it was
                          already absolutely irrelevant what <Pis or should be - the only
                          really important matter was to never break millions of legacy pages.

                          Comment

                          • VK

                            #28
                            Re: &lt;p&gt; and &lt;div&gt; and breaks


                            VK wrote:
                            From the very beginning and until relatively recently P element was not
                            a container: it was an element w./o content marking _paragraph break_
                            >
                            This way originally in HTML there were paired elements "small" line
                            break BR and "big" paragraph break P. Respectively BR marked the
                            beginning of the next line and P marked the beginning of the next
                            paragraph.
                            >
                            When later it was decided to promote P into container the task was do
                            not break millions of already existing pages. The compromise rule was
                            made as simple as moo-cow:
                            >
                            New paragraph starts with the opening <Ptag and ends by closing </P>
                            tag or by opening tag of a block element - whatever comes first.
                            I guess the question "why P is not like everyone else?" and similar
                            will stay forever, so I will bookmark this segment of the thread for
                            future quick references. For the same purpose I'll include in here the
                            answer on your original question:

                            Both
                            <P>aaa<DIV>bb b</DIV><DIV>ccc<P> ddd</DIV>
                            and
                            <P>aaa</P><DIV>bbb</DIV><DIV>ccc<P> ddd</P></DIV>
                            produce the same tree fragment:

                            #parent_node
                            |_
                            #P
                            |_#text aaa
                            |
                            #DIV
                            |_#text bbb
                            |
                            #DIV
                            |_#text ccc
                            |_#P
                            |_#text ddd

                            because P element will be auto-closed before any block-level element
                            even if closing tag is ommited. It is important that block-level vs
                            inline detection goes by default display and not by the current display
                            style.
                            This way
                            <P>aaa<DIV style="display: inline">bbb</DIV><DIV
                            style="display: inline">ccc<P>d dd</DIV>
                            doesn't change anything in the parsing process. If you are really
                            targeted to be surprised by something in HTML :-) then the latter is
                            much more appropriate subject :-)
                            At the same time say this source:
                            <P>aaa<DIV>bb b</DIV></P>
                            will produce tree fragment:

                            #parent_node
                            |_
                            #P
                            |_#text aaa
                            |
                            #DIV
                            |_#text bbb

                            because P will be automatically closed before opening <DIV>, so besides
                            other "surprises" you are getting unmatched closing </Ptag after
                            </DIV>. While HTML doesn't care of such details, XHTML parser will
                            complain.

                            Comment

                            • Andy Dingley

                              #29
                              Re: &lt;p&gt; and &lt;div&gt; and breaks


                              Kent Feiler wrote:
                              I understand that DIV elements are
                              not allowed inside P elements and I understand that the closing </p>
                              tag is optional, but unless it's somewhere stated what a browser
                              should DO when it finds a DIV that appears to be intended to be inside
                              a P, it seems like a browser-philosopy issue.
                              It is stated, although it's not directly stated and it's not clearly
                              stated.

                              "Browser philosophy" issues would be things like the rendering of
                              invalid HTML (and whether to even try), default stylesheets and error
                              recoveries. The parsing of tags into the elements that structure the
                              document model though is simple SGML behaviour pre-dating HTML, isn't
                              an error and is clearly defined with a single clear interpretation (for
                              most cases). Admittedly finding this definition requires knowing that
                              HTML is an SGML application and knowing where to find the SGML
                              definitions themselves.

                              Omitted closing tags aren't in any way "wrong" in the SGML context,
                              because SGML has always defined its parsing behaviour from a partial
                              set of tags plus a DTD into a complete document structure as a tree of
                              elements. Obviously the DOM elements are always closed and well nested
                              (the DOM can't hold a structure that isn't) and so every parsing
                              operation _must_ transform one to the other (or raise an error).
                              According to SGML's rules and for HTML that's still valid (even if
                              stripped of many closing tags) this mapping is a defined and
                              non-ambiguous process.

                              If you read the release notes for Tidy then there's a little
                              explanation of how far this strategy can go and what the awkward cases
                              are that can break it.

                              SGML set out with a design principle of allowing tags to be omitted
                              where practical, as a way of reducing verbosity. XML takes the opposite
                              approach and requires that documents (tag to element parsing anyway)
                              are parseable in isolation from their DTDs. This also requires them to
                              not use the tag omission rules, as in the abbsence of a DTD there's no
                              way to tell what the implied closures would be. XML has the
                              side-effect of making thhe document more easily human-readable too, or
                              at least more accurately human readable. Humans have historically been
                              bad at correctly interpreting terse SGML documents with much
                              implication in them.

                              Comment

                              Working...