I was experimenting, and from what I've read "position:absolute" should mean the element is positioned at an absolute position relative to its parent:
But when I try the above, each div is positioned relative to the previous one, and so appears in the wrong place, which is not what's advertised here: CSS position property
However, I've just stumbled across an insane solution. If I don't use a trailing / in the XML tag but close with </div> it now works. Do I have some kind of fundamental misunderstanding about the way XML works? Surely it should be exactly the same thing.
I see the same result in Firefox, Chrome and IE8.
I'm producing this from MSXML, so I don't necessarily have full control over how it closes the tags (or at least I don't know how to yet). Is there some kind of "work properly" mode I need to enable? Surely HTML can't be this fundamentally broken and nobody's noticed? (No doubt Nick Fitz can tell us why).
Code:
<body> <div style="background-color:yellow; height:390px; left:70px; position:absolute; top:60px; width:280px; "/> <div style="background-color:green; height:200px; left:420px; position:absolute; top:60px; width:320px; "/> <div style="background-color:red; height:270px; left:400px; position:absolute; top:330px; width:300px; "/> </body>
However, I've just stumbled across an insane solution. If I don't use a trailing / in the XML tag but close with </div> it now works. Do I have some kind of fundamental misunderstanding about the way XML works? Surely it should be exactly the same thing.
I see the same result in Firefox, Chrome and IE8.
I'm producing this from MSXML, so I don't necessarily have full control over how it closes the tags (or at least I don't know how to yet). Is there some kind of "work properly" mode I need to enable? Surely HTML can't be this fundamentally broken and nobody's noticed? (No doubt Nick Fitz can tell us why).
Comment