두 컨테이너를 세로로 배치하려고합니다. 페이지의 사용 가능한 세로 공간을 채워야합니다. 맨 아래 컨테이너가 나머지 세로 공간을 차지하고 스크롤바가 오버 플로우되는 방식으로 맨 위 컨테이너가 내용과 수직으로 확장됩니다. I의 속성의 제 2 용기 (특히, 높이)를 형성 붙어알 수없는 높이의 tvo div를 세로로 배치하여 사용 가능한 페이지 높이를 채우는 방법은 무엇입니까?
: 여기
스케치이다. 내 최고의 기회입니다.container {
margin-top: 50px;
margin-left: 25px;
margin-bottom: 50px;
position: absolute;
height: auto;
top:0;
bottom:0;
background:#ff8;
}
.first {
position: relative;
left: 0;
top: 0;
border: 1px solid red;
}
.second {
position: relative;
left: 0;
bottom: 0;
margin-top: 10px;
overflow-y: scroll;
border: 1px solid green;
}
태그 :
<div class="container">
<div class="first">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer enim mi, semper id lectus nec, tincidunt congue odio. Aliquam erat volutpat. Curabitur tellus eros, mollis malesuada imperdiet eget, congue in nisi. Donec vel nunc id libero elementum dignissim. Nulla facilisi. Mauris laoreet bibendum vestibulum. Integer odio magna, tempus eu orci quis, dignissim blandit enim. </div>
<div class="second">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</div>
</div>
그러나, 두 번째 DIV 대신에서만 사용 가능한 컨테이너 공간 스트레칭의 용기를지나 아래 흐른다.
참고 : 문제를 드러내지 않는 이유는 두 div의 높이 값을 미리 알지 못하고 내용에 따라 다릅니다. (그렇지 않으면 나는 수동으로 높이를 설정할 수있을거야 너희들을 귀찮게하지 않을거야 :))
진행 방법에 대한 힌트가 있습니까?
전체 컨테이너를 차지할 수있는 상위 상자 내에 너무 많은 콘텐츠가있는 경우 어떻게해야합니까? – cimmanon
@cimmanon이 마크 업을 추가했습니다. 이론 상으로는 탑 박스가 많은 내용으로 채워지지 않을 것이지만, 당신은 요점을 가지고 있습니다. 정말 그것을 고려하지 않았지만 두 번째 상자가 전혀 표시되지 않아야합니다. – Krizbi