Setting <div> margin for NN4

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ian Rastall

    Setting <div> margin for NN4

    This really is a JavaScript question. I have a site that looks fine in
    everything but NN4. I'm afraid I don't have a URL, because the site is
    very much unfinished.

    The site is a header (which is a table) and a main <div> underneath
    that. The main <div> is set to have a top margin of 3%, which works
    fine, except in NN4. There, it looks like it has a margin of 20%, or
    even larger.

    I couldn't fix it with the @import hack, so I thought I might try
    JavaScript. I tried something like this:

    <script language="JavaS cript" type="text/javascript">
    if (document.layer s) frank.styles.ma rgin-top = "-20%"
    </script>

    (I called the <div> "frank" ...)

    I'm very sorry, because I'm almost certain this isn't real JavaScript.
    I'm just shooting in the dark. Is this *going* in the right direction,
    or is this approach completely flawed? Would NN4 even understand
    something like this?

    TIA

    Ian
    --


  • Dom Leonard

    #2
    Re: Setting &lt;div&gt; margin for NN4

    Ian Rastall wrote:[color=blue]
    >
    > The site is a header (which is a table) and a main <div> underneath
    > that. The main <div> is set to have a top margin of 3%, which works
    > fine, except in NN4. There, it looks like it has a margin of 20%, or
    > even larger.
    >
    > I couldn't fix it with the @import hack, so I thought I might try
    > JavaScript. I tried something like this:
    >
    > <script language="JavaS cript" type="text/javascript">
    > if (document.layer s) frank.styles.ma rgin-top = "-20%"[/color]
    AFAIK you can only access a DIV element through javascript in NS4 if it
    is positioned. If it *is* positioned, then
    if(document.lay ers)
    document.layers['frank'].style.marginTo p=....;
    might get you access to the style object property of the layer and set
    its top margin. At the same time, a positioned element might better
    placed using top and left properties than margin. [Note javascript style
    properties use interCaps spelling to replace CSS hyphenated names.]

    <snip>

    Would NN4 even understand[color=blue]
    > something like this?
    >[/color]

    Probably not. NS4 used CSS positioning before it became standardised,
    and has multiple errors and inconsistencies with standard CSS.

    To understand what NS4 *might* be doing with your percentage values,
    take a Header element like
    <h1 style="font-size:200%">Hell o</h1>
    The percentage size is calculated on the default font-size of H1 and not
    the containing body (resulting in a font size of 400% for the H1
    element.) This taking base percentage from the wrong place and generally
    getting inheritance wrong or losing track of it is a big feature of NS4.
    Even with care, absolute measurements (px or pt) may be required for NS4.

    The other alternative is to put *all* CSS in the stylesheet, and use
    @media rules to make sure *none* of it is visible to NS4, which can then
    render using its default style sheet and present like a version 3 browser.

    Dom

    Comment

    • Ian Rastall

      #3
      Re: Setting &lt;div&gt; margin for NN4

      On Fri, 04 Jul 2003 14:25:02 +0930, Dom Leonard
      <doml.removethi s@senet.andthis .com.au> wrote:
      [color=blue]
      >Ian Rastall wrote:[color=green]
      >>
      >> The site is a header (which is a table) and a main <div> underneath
      >> that. The main <div> is set to have a top margin of 3%, which works
      >> fine, except in NN4. There, it looks like it has a margin of 20%, or
      >> even larger.
      >>
      >> I tried something like this:
      >>
      >> <script language="JavaS cript" type="text/javascript">
      >> if (document.layer s) frank.styles.ma rgin-top = "-20%"
      >>[/color]
      >AFAIK you can only access a DIV element through javascript in NS4 if it
      >is positioned.[/color]

      Thanks, Dom. I might give relative positioning a shot, although I'll
      never mess with absolute positioning again. The last thing I want is
      to mess up the site on every other browser. It isn't like NS4 is being
      used that much anymore.

      It's the allure of desktop-publishing-style consistency. I have that
      with every other browser I've tested.

      Thanks again,

      Ian
      --


      Comment

      • Ian Rastall

        #4
        Re: Setting &lt;div&gt; margin for NN4

        On Fri, 04 Jul 2003 01:22:26 -0400, Ian Rastall
        <idrastall@eart hlink.net> wrote:
        [color=blue]
        >Thanks, Dom. I might give relative positioning a shot[/color]

        Sorry to respond to my own post ... and man, I hate to post this on a
        JavaScript ng, but I found a solution (in CSS). This is a hack I ran
        across on a Google search. If you were to type:

        div.text {/;margin-top: 3%;}

        every browser would understand this *except* for NS4. So there you go.
        I now return you to a JavaScript discussion. <grin>

        Ian
        --


        Comment

        • Ian Rastall

          #5
          Re: Setting &lt;div&gt; margin for NN4

          On Fri, 04 Jul 2003 12:02:01 +0200, Martin Honnen
          <Martin.Honnen@ t-online.de> wrote:
          [color=blue]
          >Thus if you have a div that is not positioned no script in NN4 is able
          >to change any style of it.
          >Even if the div were positioned you could only change the visibility and
          >the clipping but not margins.[/color]

          Thanks, Martin.

          Ian
          --


          Comment

          Working...