1 reply [Last post]
chrisn
chrisn's picture
Offline
newbie
Last seen: 2 years 43 weeks ago
Timezone: GMT+1
Joined: 2016-09-12
Posts: 1
Points: 2

Hello.

I've been doing the following for many years now and I'm sure it never used to give me a problem:

CSS:

.parent-div { position:relative; }
.child-div { position:absolute; }

HTML:

<html>
<body>
<div class="parent-div">
PARENT (position:relative)
<div class="child-div"> CHILD (position absolute) </div>
</div>
<div>Just an ordinary div coming after the parent/child combo above.</div>
</body>
</html>

The problem I'm finding is that the 'normal' div, following the parent/child pair, can't get past the preceding content. It just sits on top of it as though its position was being determined by the absolute positioning of the child div.

As I said I've used this technique for years and never had a problem with any content coming after.

Has anyone got any ideas on this? Any help much appreciated!! Smile

Tony
Tony's picture
Offline
Moderator
Brisbane
Last seen: 3 weeks 3 days ago
Brisbane
Timezone: GMT+10
Joined: 2003-03-12
Posts: 5342
Points: 2963

Hi chrisn, The position

Hi chrisn,
The position absolute div will be ignored by all the other div's as it is taken out of the normal document flow.
Why do you need to position absolute in this instance?
Relative would probably give the results you are after.