레이아웃하려는 응용 프로그램이 있습니다. 왼쪽 열 내용을 제외하고는 모든 것이 좋습니다. 오른쪽 열과 동일한 높이 인 상위 컨테이너 높이 의 100 %를 표시해야합니다 .
#Container
외부 컨테이너입니다. #TreeList
왼쪽 열입니다. #Tabcontrol
오른쪽 열입니다.
지금 내 앱은 다음과 같습니다.
내 앱의 현재 CSS는 다음과 같습니다.
html {
font-family: Open Sans, Calibri, Arial;
margin: 0 auto;
width: 1500px;
}
body {
}
#Container {
float:left;
width:100%;
position:relative;
border:1px solid black;
}
#TreeList {
position:relative;
border-bottom: 1px solid #707070;
border-top: 1px solid #707070;
border-left: 1px solid #707070;
float:left;
overflow:hidden;
padding: 20px;
}
#TabControl {
position:relative;
border:1px solid #707070;
overflow:hidden;
float:left;
padding: 20px;
}
height
CSS 문서에 아무것도 설정하지 않았 으므로 모든 높이가 거의 무작위입니다. 먼저 body
& 의 기본 높이를 설정 한 html
다음 다음 container
과 같이 설정합니다.
html, body {
height: 100%;
}
#Container {
float:left;
width:100%;
position: relative;
border:1px solid black;
height: 100%;
}
그런 다음 다른 요소에 대해 :
#TreeList {
position:relative;
border-bottom: 1px solid #707070;
border-top: 1px solid #707070;
border-left: 1px solid #707070;
float:left;
overflow:hidden;
padding: 20px;
height:100%;
}
#TabControl {
position:relative;
border:1px solid #707070;
overflow:hidden;
float:left;
padding: 20px;
height: 100%;
}
또는 원하는 경우 position: absolute;
하위 요소에 사용하고 다음과 같이 할 수 있습니다 .
child {
position: absolute;
top: 0px;
left: 0px;
bottom: 0px;
width: 100px;
}
어느 요소가 전체 화면으로 스트레칭하고 폭 유지할 것이다 당신이 선택합니다.
내가보기 엔에 대한 높이를 설정하기 위해 자바 스크립트를 사용하는 것이 좋습니다 있지만 이것은 작동해야 body
뿐만 아니라 position: absolute;
대신을 relative
;
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다