473,976 Members | 45,814 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
Jul 20 '05 #1
2 3983
Hi!

Mike Mimic wrote:
I have tryed something like this:

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

Where ... is some text.


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
Jul 20 '05 #2
On Mon, 04 Oct 2004 21:53:41 +0200, in comp.infosystem s.www.authoring.stylesheets,
Mike Mimic wrote:
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.
Of course :)
Use _overflow: auto_ (will make scroll bars) or _overflow: hidden_
on your style.

In IE it does not work at all.
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.
I would like to stress that "position: fixed;" is not a solution as DIV
should scroll and be in relation to other page elements.


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
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2113
by: Jonah Bishop | last post by:
I have a strange problem that I'm hoping someone can help me with. I want a footer at the bottom of my simple HTML page to span the entire width of the page. I'm not using floats, columns or any other such complex things. Here is the ridiculously simple markup I'm using: <body> <div id="footer">A Simple Footer Test</div> </body>
14
2499
by: Harlan Messinger | last post by:
What am I not understanding about the definition of { position: absolute; }? "The box's position (and possibly size) is specified with the 'left', 'right', 'top', and 'bottom' properties. These properties specify offsets with respect to the box's containing block." Please take a look at http://gavelcade.com/abspos.html and help me understand why my nested, absolutely positioned divs are being positioned with respect to the page rather...
2
2628
by: kevinC | last post by:
Hello, I know most of you are probably going seeing positioning:absolute; and centering in the title and saying, oh no! not again! Do a google search! Actually, I've found many helpful resources online and realize that my case may be a bit more challenging. I'm trying to create a table-less layout that looks something like:
4
4767
by: Martin Eyles | last post by:
Hi, I am trying to get two divs to align at the bottom of another div. As they are nested in this div, I expected them to be positioned at the bottom of it, using the code below, but they are instead at the bottom of the body. note - I do want them on top of each other, so the only problem is - where is the bottom, and how can I make it the same as the bottom of the div. Thanks, Martin (code below) <html>
1
1900
by: Lars A. Gundersen | last post by:
So I'm starting out with CSS positioning, and it seems to work fine - until I check in IE6/Win, of course. I'm trying to use absolute positioning to place a box with my site's main contens area in middle of my pages, so that there are spaces for other things on all four sides of the area. CSS declaration: body { position: absolute; overflow: hidden; height: 100%;
2
3177
by: nonsensitor | last post by:
I'm just learning xhtml & css, primarily from westciv's online tutorials and css guide. I've run into a couple of problems with a page I'm developing that I can't figure out. The first problem is that I would like to display some text on top of an image within the header. I've tried using absolute positioning to specify where the phone number should appear in relation to the parent div (#header). However the text appears to be positioned in...
2
16438
by: nino9stars | last post by:
Hello, I have just started messing with absolute positioning on webpages, and it definitely let's you do some creative things. Well, after much searching and help, I got the images I was using to overlap correctly. You can see it on this page: www.creativekaysjewelry.com The images overlap exactly how I wanted and in the right position
7
4481
by: Chris Nelson | last post by:
I'm new to the positioning aspects of CSS and I'm going crazy trying to do something that seems like it should be fairly easy. I've Googled all over and read CSS tutorials and not found an answer. I want to divide my screen/page into four areas: a header, a footer, a menu area, and content. The particular layout I'm trying to accomplish is to have the header, menu area, and footer stacked on the left and the content as a full-height...
20
2861
by: mehstg1319 | last post by:
Hi there Not sure if anyone can help me, I am working on a site for my university, and am having a bit of trouble with css positioning. I am very new to css and do not know very much about it. Here is the link: http://homepages.feis.herts.ac.uk/~bp6ar/bus_intel/matrix/matrix.html Basically, the problem is that the ticks on the grid look perfectly
14
3337
by: Fistro | last post by:
I'm trying to find a design that would allow me to build web pages without having to worry about compatibility issues (not too much, in any case,,,) I've came across this CSS layout technique: http://alistapart.com/articles/fauxabsolutepositioning It calculates the left offset from a fixed position, as opposed to calculating it from the right edge of the preceding element by using a combination of position: relative, left: 100% and a...
0
10355
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10172
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11408
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10911
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
10084
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8462
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6416
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6558
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3762
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.