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 9120631
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:40:06+00:00 2026-06-17T05:40:06+00:00

<body> <div id=red class=colorbox><p>RED</p> <div id=green class=colorbox><p>GREEN </p> <div id=blue class=colorbox><p>BLUE</p> </div> </div> </div>

  • 0
<body>
 <div id="red" class="colorbox"><p>RED</p>
  <div id="green" class="colorbox"><p>GREEN </p>
   <div id="blue" class="colorbox"><p>BLUE</p>
   </div>
  </div>
 </div>
</body>    

How can I positioning it like this:

red block is placed between the other two in the Z axis;
green block is placed behind the red block;
blue block is placed in front of the red block.

something like this:

#red { z-index: 2; }
#green { z-index: 1 }
#blue { z-index: 3 }    

Advance inordinately thanks!

UPDATED:

Here is my code: http://jsbin.com/ihizot/3/edit

  • 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-17T05:40:07+00:00Added an answer on June 17, 2026 at 5:40 am

    Quite simply you can’t do this and be 100% cross browser supported (see the answer by mookamafoob that uses psuedo element :after to recreate the red box (not supported < IE8)).

    Because the red and blue divs are contained in the green you cannot push the stacking context of the red above it.

    I have created a simple fiddle with what would be the z-index and css needed in order to stack these as you require BUT because your markup is nested ‘incorrectly’ the red is not able to push between the green and blue divs.

    #red {
      position:absolute;
      z-index:2;
      top:15px;
      left:15px;
      height:100px;
      width:100px;
      background-color:red
    }
    #green
    {
      position:absolute;
      top:0px;
      left:0px;
      z-index:1;
      height:100px;
      width:100px;
      background-color:green;
    }
    #blue
    {
      position:absolute;
      z-index:3;
      top:30px;
      left:30px;
      height:100px;
      width:100px;
      background-color:blue;
    }
    

    Not possible as far as I know and I’m sure someone will use the correct terminology for why this happens in the browser rendering engines (anyone?)

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

Sidebar

Related Questions

Given this element: <div class=box id=trololo> <h2 class=header gradient-red></h2> <div class=body> <div class=queue> <ul
<head> <style> .thisOne{ background: red;} div[class*=thisTwo] { background: green} </style> </head> <body> <div class=thisOne>
I have the following div <body> <span style=border:1px solid red; display:inline-block> Some text<br />
how can i convert xpath like /html/body/div[3]/ul/li[1]/a[5] html > body > div[3] > ul
My HTML structure looks like this <div class=container> <div class=image><img /></div> <div class=title_body> <div
Assuming this mark-up: <html class=fr> <head> </head> <body> <div class=class1> </div> </body> </html> Will
I made this Greasemonkey script: var maxpi = 250; var p1 = /html/body/div/div[2]/div/div[2]/table[2]/tbody/tr[1]/td[11]; var
$(this).parent().parent() .children(this.attr(tagName).toLowerCase()) .css(background-color, yellow); xpath: /html/body/div/table/tr/td/b/a $(this).tagName is Anchor <a> the problem with this
My div with class name 'header-body-right' doesn't seem to be floating to the left
For example I have simple html. <body> <div class=a> <div class=child></div> <!-- div element

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.