473,394 Members | 1,663 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

No browser supports CSS2 / position:absolute?

Hello experts,

I would be very grateful if you would have a look at the following
URL:

http://www.omeganet.de/test.html

The html file and the associated style have been validated
successfully by the online validators of w3.org.

In my opinion, the word "ABSOLUTE" should appear within the blue
frame, 10 pixels from the left side of the blue frame.

According to the CSS 2.1 reference on w3.org regarding the
"position:absolute" style: "The box's position (and possibly size) is
specified with the 'top', 'right', 'bottom', and 'left' properties.
These properties specify offsets with respect to the box's containing
block.".

Since the div containing the word "ABSOLUTE" is placed within the div
with the blue frame, the div with the blue frame is the containing
block, right? So why is the word "ABSOLUTE" placed 10 pixels left from
the _browser_ window, which is completely wrong?

I get this behaviour in the latest versions of IE, Firefox, Mozilla
and Opera, so I suspect the error is on my side although I have read
the specs multiple times.

Thanks for your help

Peter
Jul 21 '05 #1
4 3111
Peter Pfannenschmid wrote:
http://www.omeganet.de/test.html

In my opinion, the word "ABSOLUTE" should appear within the blue
frame, 10 pixels from the left side of the blue frame.

According to the CSS 2.1 reference on w3.org regarding the
"position:absolute" style: "The box's position (and possibly size) is
specified with the 'top', 'right', 'bottom', and 'left' properties.
These properties specify offsets with respect to the box's containing
block.".

Since the div containing the word "ABSOLUTE" is placed within the div
with the blue frame, the div with the blue frame is the containing
block, right?


Not necessarily. The containing box is the most immediate ancestor box
whose position is not static. If there is no such box, the containing
box is the window.

--
Brian
Jul 21 '05 #2
Peter Pfannenschmid wrote:
Hello experts,
I would be very grateful if you would have a look at the following
URL: http://www.omeganet.de/test.html <snip> In my opinion, the word "ABSOLUTE" should appear within the blue
frame, 10 pixels from the left side of the blue frame.


<div style="position:relative; left:10px;">ABSOLUTE</div>

or

div.FrameBlue { border-color:#0000FF; border-width:1px;
border-style:solid; padding-top:4pt; padding-bottom:4pt; position:
relative }

http://www.juicystudio.com/tutorial/css/fixed.asp

Absolute Position

When an element is positioned absolutely, it is removed from the normal
flow, and has no effect on other elements in the normal flow. The
element is portioned according to its container block using the offset
positions left, right, top, and bottom.

*** A containing block is an element with the position property set to
relative or fixed. If the element isn't inside a containing block, the
browser window will be the containing block. ***

Mike
Jul 21 '05 #3
Peter Pfannenschmid wrote:
Hello experts,

I would be very grateful if you would have a look at the following
URL:

http://www.omeganet.de/test.html

The html file and the associated style have been validated
successfully by the online validators of w3.org.

In my opinion, the word "ABSOLUTE" should appear within the blue
frame, 10 pixels from the left side of the blue frame.

According to the CSS 2.1 reference on w3.org regarding the
"position:absolute" style: "The box's position (and possibly size) is
specified with the 'top', 'right', 'bottom', and 'left' properties.
These properties specify offsets with respect to the box's containing
block.".

Since the div containing the word "ABSOLUTE" is placed within the div
with the blue frame, the div with the blue frame is the containing
block, right? So why is the word "ABSOLUTE" placed 10 pixels left from
the _browser_ window, which is completely wrong?

I get this behaviour in the latest versions of IE, Firefox, Mozilla
and Opera, so I suspect the error is on my side although I have read
the specs multiple times.


Related to your question/problem, you should check out:
http://www.w3.org/TR/CSS21/visuren.h...ntaining-block
http://www.w3.org/TR/CSS21/visudet.h...-block-details

The 'Containing Block' is determined by the Positioning Property of both
the content element and that of the container block (nearest ancestor).

Rephrasing what has been said, the way that you have it now, the
'Containing Block' is the Viewport (initial containing block) since the
nearest ancestor to the Absolute Box is Static.

Add position:relative; in order to make FrameBlue the 'Containing
Block' for the Absolute Div and add padding:0; to remove your entered
padding amounts. The text in question will now be positioned as you want.

If you wish to have it bordered, then you will have to give FrameBlue
height, so add height:16px; (or whatever) to it and add width:100px;
(or whatever) to set the box width.

--
Gus
Jul 21 '05 #4
Gus Richter <gu********@netscape.net> wrote in message news:<bq********************@golden.net>...
Peter Pfannenschmid wrote:

Related to your question/problem, you should check out:
http://www.w3.org/TR/CSS21/visuren.h...ntaining-block
http://www.w3.org/TR/CSS21/visudet.h...-block-details

The 'Containing Block' is determined by the Positioning Property of both
the content element and that of the container block (nearest ancestor).

Rephrasing what has been said, the way that you have it now, the
'Containing Block' is the Viewport (initial containing block) since the
nearest ancestor to the Absolute Box is Static.

Add position:relative; in order to make FrameBlue the 'Containing
Block' for the Absolute Div and add padding:0; to remove your entered
padding amounts. The text in question will now be positioned as you want.

If you wish to have it bordered, then you will have to give FrameBlue
height, so add height:16px; (or whatever) to it and add width:100px;
(or whatever) to set the box width.


Dear Brian, mcir and Gus,

thank you very much for your fast and excellent advice. Indeed, I had
only read the passage where the first link mentioned by Gus points to,
but I had overlooked the passage where the second link points to.

Now I can continue my fight of converting a table-driven layout to a
CSS-driven one...

Yours sincerely,

Peter
Jul 21 '05 #5

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

Similar topics

3
by: Alexander Fischer | last post by:
Hello everybody, can someone help me with this problem: I'm creating a page with a sidebar, and I wanted to create the sidebar as a div which gets a "position:absolute". The problem: if the...
6
by: Harald Kirsch | last post by:
In the W3C document about CSS2, I read at http://www.w3.org/TR/REC-CSS2/visuren.html#choose-position the following: absolute The box's position (and possibly size) is specified with the...
4
by: KiwiBrian | last post by:
What would be the behaviour and characteristics of a div that was both positioned absolute, and floated? Are they contradictory or complementary regarding how the div is perceived by other...
3
by: Steel | last post by:
Hi at all, I'ld want to know if position:absolute is crossbrowser. Infact I cannot position absolutely an element in the some place with fox-pro and MSIE6 There is always a little difference...
6
by: alex | last post by:
I'm playing around with css popups a la http://www.meyerweb.com/eric/css/edge/popups/demo.html for here: http://www.redbrick.dcu.ie/~alex/golf/courseinfo.html (css)...
0
by: Pablito | last post by:
Hi at all, I have a little problem about position:absolute. I want to position absolutely a menu bar. if I write: menubar {position: absolute;top:5.2em;} with MSIE the menu bar is too height on...
6
by: ThunderMusic | last post by:
Hi, I think the subject says it all... thanks ThunderMusic
5
by: André Hänsel | last post by:
Hi, I want to make a horizontal navigation with the second level beneath the first level. The items of the second level shall appear left aligned with their corresponding first level item. To...
1
by: jobs | last post by:
I have a simple login page with roughly a 300px x 300px image behind the asp.net login control. I need the login control to land in the middle of the image. I want both the image and the login...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...

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.