Max Frai
Max Frai

Reputation: 64276

Absolute div and z-index

I have a div with default position argument. Now I need to put under it another div: enter image description here

#Dark
{
    width: 250px;
    height: 100px;
    background-color: #1a1a1a;
    margin: 0 auto;
    /*position: absolute;*/
    z-index: 999;
}

#Blue
{
    background-color: #046a81;
    height: 90px;
    width: 30px;
    position: absolute;
    z-index: 10;
}

How to put blue one layer down (it should be rendered before dark div) if I can't make Dark position as absolute?

Upvotes: 0

Views: 5113

Answers (1)

Niet the Dark Absol
Niet the Dark Absol

Reputation: 324650

Make the #Dark have position:relative. It still behaves as if it were in the flow, but now you can adjust the z-index.

Upvotes: 2

Related Questions