aelor
aelor

Reputation: 11116

why is one div not visible?

this is the div structure :

<div class=" wrap clear">
    <div class="block pink float"></div>
    <div class="block blue float"></div>
    <div class="block orange float"></div>
    <div class="block green see"></div>
</div>

fiddle here

What I did was adding a class named see which gave z-index 1000 to the green box. But I am still not able to see the box. I want to see the box without giving it a float left as to where it is. ?

Upvotes: 0

Views: 53

Answers (2)

netrox
netrox

Reputation: 5326

It's there, only that the DIV went back to the left side and displayed BEHIND the div's. You need to add "float" to it so it will automatically put DIV on left on the previous element.

Upvotes: 0

kei
kei

Reputation: 20491

Add this to .block:

position:relative;

z-index only works for non-static elements.

DEMO

Upvotes: 6

Related Questions