하위 요소의 높이를 부모의 백분율로 설정하려고합니다.CSS에서 어린이의 백분율 높이
.html, .body {height: 100%; width: 100%}
/* test is a child of body to ensure content is aligned in the middle */
.test {
width: 90%;
height: 100%;
position: absolute;
left: 5%;
top: 0%;
margin: -0% 0 0 0%;
}
/* top banner */
.banner {
height: 100px;
margin-left: 2%;
width: 96%;
}
/* rest of the content */
.center{
background-color: #FFFFFF;
height: 80%;
margin-left: 2%;
margin-top: 10px;
overflow-x: auto;
padding: 3px;
position: relative;
width: 95%;
}
/* content inside center */
.iwant-event {
height: 100%;
left: 0;
width: 84.5%;
}
하나는 iwant 이벤트 클래스는 중앙의 100 %를 채울 것으로 기대 : 여기 내 세트 업입니다. 크롬에서는이 동작을합니다. 그러나 Firefox에서는 iwant-event가 센터의 100 %를 채우지 않습니다. 내 HTML의 단순화 된 버전입니다 :
<body>
<div class="test">
<div class="banner">Banner stuff here</div>
<div class="center">
<div class="iwant-event"></div>
</div>
</div>
</body>
나는 기본 CSS와 상당히 정통,하지만 결코 전에 많은 브라우저에 대한 개발되지 시도했다. 나는 어떤 도움을 주셔서 감사합니다.
여백 : -0 % 0 0 0 %; – elclanrs
이 페이지가 단조롭게 렌더링되거나 엄격 모드로 렌더링됩니까? 꽤 차이가 있습니다. –