두 개의 애니메이션 (CSS에서) div가 서로 회전합니다. 중간에 텍스트 용 div를 추가하고 싶습니다. 그러나 내가 div를이 두 가지 중 하나에 넣으면 부모 div로 애니메이션이됩니다. 만약 내가 그것을 위치 시키려고한다면 그것은 단지 두 동그라미 위에 앉는다.CSS Stacking Divs
HTML
<div id="ballWrapper">
<div class="centerText"> 100</div>
<div class="ball centerHorizontal centerVertical"></div>
<div class="ball1 centerHorizontal centerVertical"></div>
</div>
CSS
centerText {
position:absolute;
left:0px;
top:0px;
margin-top:-500px;
z-index:1;
}
편집 나머지 CSS 코드 (마이너스 마진이 날 내가 그것을 얻을 수 있는지 확인하기 위해 실험되었다 너무 위나 아래로 움직임)
.ball {
background-color: rgba(67,181,162,0.3);
border: 5px solid rgba(67,181,162,0.9);
opacity: .9;
border-top: 5px solid rgba(0,0,0,0);
border-left: 5px solid rgba(0,0,0,0);
border-radius: 300px;
box-shadow: 0 0 35px #43B5A2;
width: 200px;
height: 200px;
margin: 0 auto;
-moz-animation: spin 3.5s infinite linear;
-webkit-animation: spin 3.5s infinite linear;
}
.ball1 {
background-color: rgba(67,181,162,0.7);
border: 5px solid rgba(67,181,162,0.9);
opacity: .9;
border-top: 5px solid rgba(0,0,0,0);
border-left: 5px solid rgba(0,0,0,0);
border-radius: 300px;
box-shadow: 0 0 15px #43B5A2;
width: 170px;
height: 170px;
margin: 0 auto;
position: relative;
top: -195px;
-moz-animation: spinoff 3.5s infinite linear;
-webkit-animation: spinoff 3.5s infinite linear;
}
.header {
width:100%;
position:absolute;
margin-top:-200px;
}
.centered {
display: block;
margin-left: auto;
margin-right: auto
}
#ballWrapper {
margin-top:200px;
z-index:0;
text-align:center;
}
.minusMargin{
margin-top:-100px;
}
.centerText {
position:absolute;
left:0px;
top:0px;
margin-top:-500px;
z-index:1;
}
'margin-top : -500px'는 무엇입니까? 우리는 다른 요소들에 대해서도 CSS를 볼 필요가 있습니다. 또한 선택자가 작동하는지 확인하십시오 (나는 .centerText 대신에'centerText'가 있음을 알았습니다). '# ballWrapper' 클래스는'position : relative;'또는 비슷하게 설정된 것이 필요합니다. – mtaube