I would like to create a paradoxical effect via the z-index
CSS property.
In my code I have five circles, like in the image below, and they are all absolute
My attempt also using clip
. The idea was to have half and half for the div
. That way setting z-index
would work.
So you can set the top part to z-index: -1
and the bottom to z-index: 1
.
.item {
width: 50px;
height: 50px;
line-height: 50px;
border: 1px solid red;
background: silver;
border-radius: 50%;
text-align: center;
}
.under {
z-index: -1;
}
.above {
z-index: 1;
overflow: hidden;
clip: rect(30px 50px 60px 0);
}
.i1 {
position: absolute;
top: 30px;
left: 0px;
}
.i2 {
position: absolute;
top: 0px;
left: 35px;
}
.i3 {
position: absolute;
top: 30px;
left: 65px;
}
.i4 {
position: absolute;
top: 70px;
left: 50px;
}
.i5 {
position: absolute;
top: 70px;
left: 15px;
}
1
1
2
3
4
5
DEMO HERE
Note: Tested on IE 10+, FF 26+,Chrome 33+ and Safari 5.1.7+.