Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 21st, 2005, 12:55 AM
Mike Mimic
Guest
 
Posts: n/a
Default 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
  #2  
Old July 21st, 2005, 12:55 AM
Mike Mimic
Guest
 
Posts: n/a
Default 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
  #3  
Old July 21st, 2005, 12:56 AM
Salagir
Guest
 
Posts: n/a
Default Re: Absolute positioning with top and bottom

On Mon, 04 Oct 2004 21:53:41 +0200, in comp.infosystems.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
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles