Hello,
as I understand the specs http://www.w3.org/TR/CSS21/visuren.html#x19 an
absolute positioned block element is positioned relative to its parent
element. This is told in the german selfhtml reference, too: http://de.selfhtml.org/navigation/cs...positionierung
In fact firefox and konqueror do position the block relativ to the window
border. This is explained here, too: http://www.w3schools.com/dhtml/dhtml_css.asp
Which behaviour is correct?
Here is an example:
<html>
<head>
<style type="text/css">
#header { height: 44px;
border: 1px solid black;}
#copyright { border: 1px solid green;
position: absolute;
right: 12px;
bottom: 0px; }
</style>
</head>
<body>
<div id="header">
<div id="copyright">
blah foo text
</div>
</div>
</body>
</html>
-- 6 18805
Gert Brinkmann wrote: as I understand the specs http://www.w3.org/TR/CSS21/visuren.html#x19 an absolute positioned block element is positioned relative to its parent element.
No, to its containing block, which is defined as the nearest ancestor
element which has a position property with a value other than "static". If
there is no such element then it is from the edges of the viewport.
In fact firefox and konqueror do position the block relativ to the window border.
Only if there isn't a containing block ... and you don't have any toolbars
or menu bars in your window.
This is explained here, too: http://www.w3schools.com/dhtml/dhtml_css.asp
W3Schools - wrong again.
--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
David Dorward wrote: Gert Brinkmann wrote:
as I understand the specs http://www.w3.org/TR/CSS21/visuren.html#x19 an absolute positioned block element is positioned relative to its parent element.
No, to its containing block, which is defined as the nearest ancestor element which has a position property with a value other than "static". If there is no such element then it is from the edges of the viewport.
Thank you very much for your answer. It's unbelievable, but it is true. This
is the way, firefox behaves (I did not check other browsers). Hmm, does
this behaviour make sense? But ok, this is not the question here.
Thanks again,
Gert
>> No, to its containing block, which is defined as the nearest ancestor element which has a position property with a value other than "static". If there is no such element then it is from the edges of the viewport.
Thank you very much for your answer. It's unbelievable, but it is true. [...]
Why is it unbelievable? It provides a way to position:absolute in any
containing block.
--
jmm dash list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
Jim Moe wrote: Why is it unbelievable? It provides a way to position:absolute in any containing block.
Certainly yes, but IMHO it is not very intuitive. If you lay out a DIV
containing a lot of styled HTML, I do not like that the content changes
layout if you change the placing of the DIV. But perhaps I first have to
internalise(?) this technique.
Gert
Gert Brinkmann wrote : David Dorward wrote:
Gert Brinkmann wrote:
as I understand the specs http://www.w3.org/TR/CSS21/visuren.html#x19 an absolute positioned block element is positioned relative to its parent element.
No, to its containing block, which is defined as the nearest ancestor element which has a position property with a value other than "static". If there is no such element then it is from the edges of the viewport.
Thank you very much for your answer. It's unbelievable, but it is true. This is the way, firefox behaves (I did not check other browsers). Hmm, does this behaviour make sense? But ok, this is not the question here.
Thanks again,
Gert
I personally reported this bug at Opera some 30 months ago when Opera
7.0 beta 1 came out. I also reported the problem, that precise bug to
MSIE 7 dev. team too.
"percentage width value on absolutely positioned elements should
calculate the %tage of the containing block, not %tage of the immediate
parent node of the abs. pos. elements. Safari 1.x and Mozilla-based
browsers supports this correctly (...)" http://channel9.msdn.com/wiki/defaul...rSupportforCSS
FYI, Opera 6.06 did not have that bug: it was positioning an abs. pos.
element regarding its positioned ancestor otherwise relative to the
viewport dimension.
Gérard
--
remove blah to email me
Gert Brinkmann wrote: Jim Moe wrote:
Why is it unbelievable? It provides a way to position:absolute in any containing block.
Certainly yes, but IMHO it is not very intuitive. If you lay out a DIV containing a lot of styled HTML, I do not like that the content changes layout if you change the placing of the DIV. But perhaps I first have to internalise(?) this technique.
See it this way:
If you have
<div class="a">
..
<div class="b">..</div>
..
</div>
and div.b should be positioned relative to div.a, you don't want the layout
to change, if you insert (for semantic reasons) another level inbetween:
<div class="a">
..
<div>
<div class="b">..</div>
</div>
..
</div>
--
Benjamin Niemann
Email: pink at odahoda dot de
WWW: http://www.odahoda.de/ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Mike |
last post by:
I've been working on a pop-up menu, one of those where you mouse over
a button and a submenu pops up. Because the client wanted the menu
centered, I gave the starting point of the submenu an...
|
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...
|
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...
|
by: Markus Ernst |
last post by:
Hello
Reading the follwing document:
http://www.w3.org/TR/WD-positioning-970131#In-flow
it seems very clear that position:relative should be relative to the parent
element. So in the following...
|
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...
|
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...
|
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)...
|
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...
|
by: ThunderMusic |
last post by:
Hi,
I think the subject says it all...
thanks
ThunderMusic
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
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...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |