Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 439957
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T20:49:30+00:00 2026-05-12T20:49:30+00:00

I have two relative positioned DIVs A & B. a has a DIV as

  • 0

I have two relative positioned DIVs A & B. a has a DIV as child element called A’ which is absolute positioned and has a z-index of 1000. DIV B’ is a child element of DIV B and positioned absolute as well.

Firefox renders this as expected: A’-B’-B-A(from nearest to farest from the user)
However, in IE7 I get: B’-B-A’-A

Please can someone help me out with a workaround? I’ve already wasted hours with this problem!

Thanks in advance,
Stephan

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T20:49:31+00:00Added an answer on May 12, 2026 at 8:49 pm

    The issue is that in IE7 and earlier, it basically “resets” the z-index inside of relative positioned items.

    If none of these work see ‘The Last Resort’ below

    so in IE in this case the BAR would be above FOO in IE7’s lame indexing method:

    <div style="position:relative;">
      <div style="position:absolute; z-index:1000;">FOO</div>
    </div>
    <div style="position:relative;">
      <div style="position:absolute; z-index:1;">BAR</div>
    </div>
    

    The workaround is equally lame; You have to make sure the parent of the items you want to be on top are z-indexed higher than the parents of the one you want on the bottom.:

    <div style="position:relative; z-index:2;">
      <div style="position:absolute; z-index:1000;">FOO</div>
    </div>
    <div style="position:relative; z-index:1">
      <div style="position:absolute; z-index:1;">BAR</div>
    </div>
    

    OR you can swap which one comes first in the HTML causing one to be rendered over the other.

    <div style="position:relative;">
      <div style="position:absolute; z-index:1;">BAR</div>
    </div>
    <div style="position:relative;">
      <div style="position:absolute; z-index:1000;">FOO</div>
    </div>
    

    NOTE: This is all assuming that you’re doing something with FOO and BAR that are causing them to overlap. My example clearly does not overlap so the effect would be hard to see if you copied and pasted it outright.

    ADDED:

    The Last Resort

    To put it simply, this option sucks. But it’s the only option if you absolutely must deal with this issue in IE7 and earlier.

    Use JavaScript to move your div and position it where it needs to be. The basic idea here is to pull the absolute positioned div out to the body node and move it to where it needs to be. I would HIGHLY recommend using jQuery to do all of this. I made the example code without jQuery, but if you’re not using jQuery yet, you should start. It will get this job done in a few lines.

    <body>
        <div style="position:relative; z-index:2;"> 
            OUTERFOO 
            <div style="position:absolute; z-index:1000; background:red;">
                FOO
            </div> 
        </div> 
        <div style="position:relative; z-index:1">
            OUTERBAR 
            <div id="bar" style="position:absolute; top:-30px; z-index:1; background:green;">
                BAR
            </div>
        </div>
        <button onclick="moveThisCrapForIE7();">Test</button>
        <script type="text/javascript" language="javascript">
            // Probably best to kick this off when your body is totally loaded.
            // jQuery's $(document).ready is really good for that.
            // for now I'm just using a button to test.
            function moveThisCrapForIE7() {
                // You'll need something more reliable for browser detection here, this will only get IE7 not IE6.
                // I'd recommend jQuery for everything really. It'll save you miles of code.
                if(navigator.appVersion.indexOf('MSIE 7') > -1) {
                    // Get your element and move it to where you want it.
                    var bar = document.getElementById('bar');
                    document.body.appendChild(bar);
                    //Then you'll need to monkey with the location 
                    // to make sure it's where you want it.
                    bar.style.top = '15px';
                    bar.style.left = '90px';
                    bar.style.zIndex = '3';
                }
            }
        </script>
    </body>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 314k
  • Answers 314k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer LINQ to entities is completely isolated from your data access… May 13, 2026 at 11:06 pm
  • Editorial Team
    Editorial Team added an answer Send the two parts with separate communication channels. Use a… May 13, 2026 at 11:05 pm
  • Editorial Team
    Editorial Team added an answer This is somewhat misleading, since an interface, by definition, provides… May 13, 2026 at 11:05 pm

Related Questions

I have two divs one above the other. The second on is absolutely positioned
I'm having a strange problem positioning a set of divs inside another div. I
I have some markup for a popup menu that works in firefox but not
Humbly asking for help with (of course) IE. I have a div that is

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.