下圖是我的目標。我有4個div全部設置爲圈子。我想按照下面的圖片對齊它們。這可能與只是CSS的Z指數?如果有人有一些見解,我一直在努力想出一個解決方案。你可以在小提琴中看到我的進步。css z-index重疊divs
http://jsfiddle.net/v7d4s210/1/
<div id="circleContainer">
<div class="circle spin yellow"></div>
<div class="circle spin orange"></div>
<div class="circle spin red"></div>
<div class="circle spin purple"></div>
</div>
.circle {
border-radius: 50%;
display: inline-block;
margin-right: 20px;
}
#circleContainer {
width:600px;
display: block;
margin: 0 auto;
background: #f5f5f5;
position: relative;
top:200px;
}
.yellow{
width: 250px;
height: 250px;
background:red;
position: absolute;
z-index: 4;
top:-100px;
}
.orange{
width: 250px;
height: 250px;
background:blue;
position: absolute;
z-index: 3;
left:100px
}
.red{
width: 250px;
height: 250px;
background:green;
position: absolute;
z-index: 2;
left: -100px;
}
.purple{
width: 250px;
height: 250px;
background:pink;
position: absolute;
z-index: 1;
top:100px;
}
這是怎麼回事?'.red {background:green}'? – Dan 2014-09-18 22:14:41
哦,他們是我的代碼中的漸變,所以我試圖縮短它們真正快速。 – nick 2014-09-18 22:17:09