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

  • SEARCH
  • Home
  • 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 8717165
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T06:14:59+00:00 2026-06-13T06:14:59+00:00

I have 3 elements, two on the same level, and one child, all having

  • 0

I have 3 elements, two on the same level, and one child, all having fixed position. I need to set the z-index properties to place the parent on the bottom, the element on the same level in the middle, and the child on top.

I’ve tried setting a higher z-index for the child, but it’s not working.

<div class="red">
    <div class="blue"></div>
</div>
<div class="green"></div>

Here is the case http://jsfiddle.net/udENm/21/ (I need red on the bottom, green in the middle and blue on top, still maintaining red and greenon the same level).

My CSS is like this

.red {
    position: fixed;
    z-index: 2;
}

.green {
    position: fixed;
    z-index: 2;
}

.blue {
    position: fixed;
    z-index: 5;
}
  • 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-06-13T06:15:00+00:00Added an answer on June 13, 2026 at 6:15 am

    The green blocks z-index needs to be lower than the red ones. I used this CSS instead of the one you posted:

    .foo {
        background: red;
        position: fixed;
        left: 50px;
        top: 50px;
        z-index: 2;
        width: 100px;
        height: 100px;
    }
    
    .bar {
        background: green;
        position: fixed;
        left: 100px;
        top: 100px;
        z-index: 1;
        width: 100px;
        height: 100px;
    }
    
    .child {
        background: blue;
        position: absolute;
        top:50%;
        left:50%;
        z-index: 5;
        width: 50px;
        height: 50px;
    }
    

    Works fine, as you can see green is now z-index 1, red is z-index 2 and the blue block has absolute positioning.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following HTML with two elements having the same name <input type=hidden name=
Hello I need to check if two lists have same elements in same order
I have two HTML elements that share the same space- when one is visible,
I have two span elements that I would like to stay on the same
I want to be able to have two Haml elements on the same line.
I have two enumerables with the exact same reference elements, and wondering why Equals
I have two div -elements, the top one has the height of 40% and
I have two lists old and new , with the same number of elements.
I have two elements that shouldn't be active at the same time, so when
Is there a way to check if two elements have the same class name?

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.