3 열 레이아웃이 모두 같은 높이 (높이를 미리 알 수 없으므로 높이에 하드 코드 된 값을 지정할 수 없음)를 만드는 중입니다. 여기에 설명 된 기술을 사용하여 :CSS 세로 정렬 및 인라인 블록 문제
http://matthewjamestaylor.com/blog/equal-height-columns-cross-browser-css-no-hacks
내가 사용하려는 다소 때문에이 방법을 변경하고 "를 표시 : 인라인 블록"대신 "플로트 : 왼쪽". 내가 사용하고있는 코드는 다음과 같습니다.
내가 겪고있는 문제는 인라인 블록이 제대로 작동하지 않는 것입니다. 즉, 각 3 개의 div가 나란히 배치되어 있기 때문입니다. 아무도 왜 이것이 작동하지 않는지 설명 할 수 있습니까?
#col1 {
width:33.33333333%;
vertical-align: top;
margin-left: 66.66666667%;
display: inline-block;
}
#col2 {
width:33.33333333%;
vertical-align: top;
margin-left: 100%;
display: inline-block;
}
#col3 {
width:33.33333333%;
vertical-align: top;
margin-left: 133.33333333%;
display: inline-block;
}
#container3 {
width: 100%;
margin-left: 0%;
background-color: green;
overflow:hidden;
}
#container2 {
width: 100%;
margin-left: -33.33333333%;
background-color: yellow;
}
#container1 {
width: 100%;
margin-left: -33.33333333%;
background-color: red;
}
가 여기 내 실제 HTML이다 :
여기 내 CSS입니다
<!doctype html>
<html>
<head>
<title>My Sample Columns</title>
<link rel="stylesheet" type="text/css" href="styles.css">
</head>
<body>
<div id="container3">
<div id="container2">
<div id="container1">
<div id="col1">
one one one one one one one one one one one one one one one one one one one one one one one one one one one one one one one one one one one one one one one one one one one one one one one one one
</div>
<div id="col2">
two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two
</div>
<div id="col3">
three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three three
</div>
</div>
</div>
</div>
</div>
</body>
</html>
너비 33 %가 모든 브라우저에서 작동하지 않습니다. 33 % 미만이어야합니다. 브라우저가 폭을 계산하는 방법에 따라 덜 좌우됩니다. 일반적으로 여백이없는 경우 32 %가 작동합니다. – Misunderstood