절대 위치 자식을 절대 위치 부모 뒤에 표시하려고합니다. 파란 부모는 빨간 아이 위에 나타납니다.절대 위치 부모를 절대 위치 자식 위에 표시하십시오.
자식에 z-index: -1
설정을 시도했지만 빨간색 자식을 표시하지 않습니다.
.container {
position:relative;
background-color:grey;
width: 500px;
height: 500px;
}
.parent {
background-color:blue;
position:absolute;
top: 50px;
left: 10px;
height: 100px;
width: 100px;
border-radius: 100%;
}
.child {
position:absolute;
top:-5px;
right: 0px;
width: 30px;
height: 30px;
border-radius: 100%;
background-color:red;
}
<div class="container">
<div class="parent">
<div class="child"></div>
</div>
</div>
https://jsfiddle.net/dwil30/mh3qw64x/
인가? 형제 인 경우 훨씬 더 간단합니다. – Matt
이상적입니다. 왜냐하면 나는 jquery를 draggable 부모를 사용하고 있기 때문에 나는 부모와 자식 관계를 유지하고 싶습니다. 그러나 형제 자매로 이사하는 것이 유일한 방법 일 경우, 나는 그 일을해야 할 것입니다 ... –
두 가지 중에서 가장 좋은 점을 얻을 수 있습니까? 부모와 같은 크기로 드래그 할 수있는 조부모 요소를 만듭니다. 부모와 자식은 형제가됩니다. – Scoots