현재 HTML 구조가 있습니다.
<release_cover>
<overlay_controllers> Green Div </overlay_controllers>
<img src="blu.div" />
</release_cover>
img 태그는 파란색 컨테이너입니다. 자홍색은 release_cover 태그입니다.
overlay_controller 태그 (녹색)를 컨테이너의 80 %에 정확히 위치하는 20 % 높이로 설정하는 데 문제가 있습니다.
지금까지 :
release_cover{
width: 100%;
height: 100%;
position: relative;
}
release_cover img{
width: 100%;
height: 100%;
}
overlay_controllers{
min-height: 20%;
margin-top: 80%;
position: absolute;
width: 100%;
}
불행히도 녹색 div의 높이는 고정 된 20 %가 아니라 내부에 무엇이 있는지에 따라 다릅니다.
제안?
(지금까지받은 제안이있는 예 : https://jsfiddle.net/82Lb0nhe/ )
absolute
와 함께 위치 조합을 사용하는 top
동시에 height
보다 큰 값을 허용하지 않으면 300px
올바르게 계산됩니다.
.container {
width: 300px;
height: 300px;
}
overlay_controllers {
z-index: 2;
bottom: 0%;
position: absolute;
margin-top:;
height: 20%;
width: 100%;
background-color: #fc0;
}
release_cover {
top: 0px;
width: 100%;
position: relative;
display: block;
overflow: hidden;
margin: 0px;
padding: 0px;
max-height: 300px;
}
release_cover img {
padding: 0;
margin: 0px;
z-index: 1;
width: 100%;
height: 100%;
}
작업 바이올린 : https://jsfiddle.net/fL98w9of/
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다