473,320 Members | 1,987 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,320 software developers and data experts.

position:absolute implementation seems to contradict W3C definition

In the W3C document about CSS2, I read at

http://www.w3.org/TR/REC-CSS2/visure...hoose-position

the following:
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.

The implementation in firefox/mozilla as well as examples
and tutorials on the web say that position:absolute positions
HTML elements with respect to "the document", which seems
to be the root <html> element.

In contrast, I thought that "containing blocks" are generated
also by other elements than <html>, e.g. by <div> or <p>. As
such I would expect e.g. style="top:0px" refer to the edges
of these elements rather than to the edge of the document.

Is the implementation wrong (doubt it), is my understanding
of "containing block" wrong, or is there a special rule for
"containing block" in HTML which says that only the document
root creates a containing block?

Thanks,
Harald.
Jul 20 '05 #1
6 4828
Harald Kirsch wrote:
Is the implementation wrong (doubt it), is my understanding
of "containing block" wrong, or is there a special rule for
"containing block" in HTML which says that only the document
root creates a containing block?


See position: relative;

--
Mark.
http://tranchant.plus.com/
Jul 20 '05 #2
On 17 Sep 2004 02:26:59 -0700, Harald Kirsch <pi*******@gmx.de> wrote:
Is the implementation wrong (doubt it), is my understanding
of "containing block" wrong, or is there a special rule for
"containing block" in HTML which says that only the document
root creates a containing block?


In many documents the containing block is the viewport. But if a parent
element has position set to relative, absolute or fixed, it is now a
containing block for what lies within.

Ex.

.... content ...
<div>
... content ...
<div style="position: absolute; top: 1em;">...</div>
<div>

The inner div will be 1em from the top of the viewport.

.... content ...
<div style="position: relative;">
... content ...
<div style="position: absolute; top: 1em;">...</div>
<div>

The inner div is 1em from the parent div.
Jul 20 '05 #3
In article <16**************************@posting.google.com >,
pi*******@gmx.de says...
In the W3C document about CSS2, I read at
http://www.w3.org/TR/REC-CSS2/visure...hoose-position absolute
The implementation in firefox/mozilla as well as examples
and tutorials on the web say that position:absolute positions
HTML elements with respect to "the document", which seems
to be the root <html> element.
As mozilla don't relly speak, you most likely didn't see all.
No tutorial or example in internet is flawless...
In contrast, I thought that "containing blocks" are generated
also by other elements than <html>, e.g. by <div> or <p>. As
such I would expect e.g. style="top:0px" refer to the edges
of these elements rather than to the edge of the document.
No, that is clarly defined, absolute positioning is outside normal flow.
Look relations between absolute and relative and static positioning.
Is the implementation wrong (doubt it), is my understanding
of "containing block" wrong, or is there a special rule for
"containing block" in HTML which says that only the document
root creates a containing block?


There is "initial containing block", to which absolute elements are
positioned. There is no "the way" to render absolute position - that is
because how initial containing block is defined, or rather, isn't
defined. But it is not very often you ran to problems because this,
unless you do something really advanced.

--
Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
Jul 20 '05 #4
Neal <ne*****@yahoo.com> wrote in message news:<op**************@news.individual.net>...
On 17 Sep 2004 02:26:59 -0700, Harald Kirsch <pi*******@gmx.de> wrote:
Is the implementation wrong (doubt it), is my understanding
of "containing block" wrong, or is there a special rule for
"containing block" in HTML which says that only the document
root creates a containing block?


In many documents the containing block is the viewport. But if a parent
element has position set to relative, absolute or fixed, it is now a
containing block for what lies within.


Thanks, that is exactly the information I was missing. Is this
true only for HTML or also for XML?

Harald.
Jul 20 '05 #5
On 20 Sep 2004 02:33:11 -0700, Harald Kirsch <pi*******@gmx.de> wrote:
Neal <ne*****@yahoo.com> wrote in message
news:<op**************@news.individual.net>...
On 17 Sep 2004 02:26:59 -0700, Harald Kirsch <pi*******@gmx.de> wrote:
> Is the implementation wrong (doubt it), is my understanding
> of "containing block" wrong, or is there a special rule for
> "containing block" in HTML which says that only the document
> root creates a containing block?


In many documents the containing block is the viewport. But if a parent
element has position set to relative, absolute or fixed, it is now a
containing block for what lies within.


Thanks, that is exactly the information I was missing. Is this
true only for HTML or also for XML?

Harald.


It certainly applies to HTML and XHTML. I'm not familiar enough with
general XML to address the other point.
Jul 20 '05 #6
Neal <ne*****@yahoo.com> writes:
It certainly applies to HTML and XHTML. I'm not familiar enough with
general XML to address the other point.


Well, you can apply a CSS stylesheet to an XML document - and if you
view it in something capable of dealing with both, you can get any
rendering you'd normally be able to with CSS.

Every element defaults to display inline, normal text, which is
usually useful. As a way of making an XML document (more) human
readable, it's quite good (especially if you can view it in something
that supports CSS-generated content to display attribute values). For
use on the web it's not particularly useful due to lack of support and
lack of standard semantics.

--
Chris
Jul 20 '05 #7

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...
4
by: Peter Pfannenschmid | last post by:
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...
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...
2
by: Joachim Bauer | last post by:
I'm using the code below to display a menu that opens when the mouse goes over the main menu item (try it in your browser to understand the behaviour). It uses "position:absolute" and a switch...
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)...
2
by: Laphan | last post by:
Hi All I have developed a site whereby it uses the contents of a folder (incs gifs, jpgs and css files) to display the web 'skin' of the site. This is OK, but each button on the site is an...
2
by: boclair | last post by:
I have just been reading the thread "reason behind containing block rule" It reminded me of a question I have had unresolved for some time What are the rules on the default width of an element...
19
by: derelicten | last post by:
hello , I have an issue positionating some pics I want to anchor to an existing table cell but I cant just place regular position on the cell because the background is fixed height and the set of...
6
by: ThunderMusic | last post by:
Hi, I think the subject says it all... thanks ThunderMusic
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.