Absolute positioning with top and bottom

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mike Mimic

    Absolute positioning with top and bottom

    Hi!

    I would like to make something like this:

    +-----------------+
    |A |
    | |
    | +----+ |
    | |B | |
    | | | |
    | +----+ |
    | |
    +-----------------+

    A is a body and B is a DIV which has fixed distance above and bellow (so
    its height depends on body height).

    What I would like is that for short DIV content there is fixed distance
    atop and bellow. But if content is bigger than it is possible to put
    into that DIV height, DIV should grow and make body bigger too - so the
    distance atop and bellow would be still fixed;

    I have tryed something like this:

    <div style="position : absolute; width: 200px; top: 100px; bottom: 25px;
    background: #ff0000;> ... </div>

    Where ... is some text.

    It works in Mozilla for short texts. But for longer ones text "breakes"
    out of the box - how is this possible? - so DIV height is fixed to
    window height but text just goes on and on.

    In IE it does not work at all.

    I would like to stress that "position: fixed;" is not a solution as DIV
    should scroll and be in relation to other page elements.

    Maybe there is some other solution to it. Like for example:

    +-----------------+
    |A |
    | |
    | +----+ |
    | |B | |
    | | | |
    | +----+ |
    | |C | |
    +-----------------+

    Where C is a small transparent DIV which make space under the B DIV. But
    the problem is how to tell B DIV to have height such that C will be
    always at the bottom of the page or screen (whichever comes last).


    Mike
  • Mike Mimic

    #2
    Re: Absolute positioning with top and bottom

    Hi!

    Mike Mimic wrote:[color=blue]
    > I have tryed something like this:
    >
    > <div style="position : absolute; width: 200px; top: 100px; bottom: 25px;
    > background: #ff0000;> ... </div>
    >
    > Where ... is some text.[/color]

    I think that this will be enough as I think I can get all coordinates
    for "top" and "bottom" so text will not overlap.

    But how can I make this simple DIV in IE?


    Mike

    Comment

    • Salagir

      #3
      Re: Absolute positioning with top and bottom

      On Mon, 04 Oct 2004 21:53:41 +0200, in comp.infosystem s.www.authoring.stylesheets,
      Mike Mimic wrote:[color=blue]
      > I have tryed something like this:
      ><div style="position : absolute; width: 200px; top: 100px; bottom: 25px;
      > background: #ff0000;> ... </div>
      >
      > It works in Mozilla for short texts. But for longer ones text "breakes"
      > out of the box - how is this possible? - so DIV height is fixed to
      > window height but text just goes on and on.[/color]

      Of course :)
      Use _overflow: auto_ (will make scroll bars) or _overflow: hidden_
      on your style.

      [color=blue]
      > In IE it does not work at all.[/color]

      Yeah, IE sucks.
      It understands only a _top_ OR _bottom_ with a _height_.

      If you dont wan't to use that, there is a ie hack that work, just a pain
      to use, and losing the doctype (needs quirk mode), I don't think it's
      hard to find on the net.
      [color=blue]
      > I would like to stress that "position: fixed;" is not a solution as DIV
      > should scroll and be in relation to other page elements.[/color]

      Plus, IE doesn't understand fixed either.


      --
      My Webcomic: www.geeksworld.org -+- All my websites: manaworld.free. fr
      <studmuffn> one day i will find a way to implant annoying songs
      in other peoples heads
      <studmuffn> it will be my supervillian power

      Comment

      Working...