HTML question

edited October 2001 in General Discussion

Comments

  • edited December 1969
    I'm trying to use a DIV with align=center, and the results are different in IE than in Netscape.

    It looks as though the reason is that the width of the DIV is different. Apparently in IE, the DIV is as wide as its widest contained element, while in Netscape it is as wide as the window.

    The IE behavior is what I want. How would one force that in Netscape?


  • edited December 1969
    Re: HTML question

    Not totally sure what you mean. Can you put an example of the HTML online?

    namebanner.gif
  • edited December 1969
    [b]Re: HTML question[/b]

    I tried to make a simple example, and it didn't behave like I expected.

    After further investigation... it appears that Netscape only breaks things if there is a form inside the div, and paragraph markup inside the form. Silly me for not knowing that! (?)

    Here's an example: http://www.clanplaid.net/~johnny/divtest.html

    The top div does not have paragraph markup inside the form; the bottom one does.

    In Netscape:

    image

    In Explorer:

    image

    Note that even in the "good" case in Netscape, the bottom bar is not right up against the left margin like it should be (and like the top bar is). Sigh.

  • edited December 1969
    Re: HTML question

    More fun... on my PC at home, Mozilla renders this like Netscape 6. On my Linux box at work, Mozilla renders this like Explorer... almost. It still has the problem of adding a tiny horizontal offset to the bottom bar in the div.

    Fortunately in my actual application for this, an offset like that won't be noticeable, and I don't think I'll really need to use paragraph markup in the form anyway.


  • edited December 1969
    closure?

    Looks like using "text-align: center" in the style attribute, rather than setting align=center, makes Mozilla happier in general. Hopefully IE will like that too. I think that's the most standards-compatible way to do things.

    Netscape 4, of course, totally barfs on that. It renders it correctly when you load the page, but then left-aligns everything if you resize the window. Yee haw!


  • edited December 1969
    Re: closure?
    Looks like using "text-align: center" in the style
    attribute, rather than setting align=center, makes Mozilla
    happier in general. Hopefully IE will like that too. I think
    that's the most standards-compatible way to do things.

    Netscape 4, of course, totally barfs on that. It renders it
    correctly when you load the page, but then left-aligns
    everything if you resize the window. Yee haw!
    Heh, welcome to the reason Netscape 4 sucks :)

    You can do abosultely everything right, and still get screwwed over. Best I can tell your doing the best I can think of. Then again I havn't really don't any all DIV pages yet. Too many NS 4 users :(

    namebanner.gif
  • edited December 1969
    Re: closure?
    Looks like using "text-align: center" in the style
    attribute, rather than setting align=center, makes Mozilla
    happier in general. Hopefully IE will like that too. I think
    that's the most standards-compatible way to do things.
    From what a web programming friend tells me, you should be using a DTD STRICT header with Mozilla if you want it to be standards compliant. By default, with no DTD line, Moz enters a compatability mode that attempts to work the best it can with 'old' HTML. The philosophy is that if the web designer knows what they are writing, listen to them. If not, assume the worst and do the best we can to make the page readable.

    I don't have a reference for you, but he might be able to give me one if you're curious...



    charon.gif
  • edited December 1969
    Re: closure?

    Probably something like [!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"[

    Haven't tried that yet to see what effect it would have. The reason is that I'm doing some things that are not in HTML 4.01, for backwards compatibility. In particular I think HTML 4.01 wants text inside forms to be wrapped with [label] markup, but if I do that then the text disappears in earlier browsers. I may take another shot at seeing what I can do about that though.

  • edited December 1969
    [b]Re: closure?[/b]

    O Irony, thy name is HTML. Turns out that what HTML 4.01 really wants is some sort of block markup around the contents of the form... i.e., the paragraph markup that was causing all these problems. Looks like I can stick it back in there though and have things still work if I specify a fixed width in the div style.

Sign In or Register to comment.