두 개의 div 상자가 서로 옆에 있습니다. 왼쪽 상자에는 "div 테이블"이 있습니다. 페이지의 크기를 조정할 때 왼쪽 div 테이블의 내용을 숨길 수 있습니다. 오버플로 : 숨김. 그러나 왼쪽 상자에는 "남은"공백이 있고 오른쪽 상자에는 35 %의 너비가 있습니다.남은 공간을 기준으로 div 테이블의 내용을 숨기기
div 테이블의 내용이 "나머지 공간"(왼쪽 상자의 너비)보다 넓은 경우 테이블의 오른쪽 테두리보다 더 이상 보이지 않습니다.
이미지의 나머지는 숨기고 div 테이블의 오른쪽 테두리는 계속보고 싶습니다. div 테이블을 사용하여이 작업을 수행 할 수 있습니까?
HTML
<div class="table" id="containerRight">Some content on the right</div>
<div id="containerLeft">
<div class="table" id="tableLeft">
<div class="table-row">
<div class="table-cell">
<div style="width:14px;"></div>
</div>
<div class="table-cell">Some title</div>
<div class="table-cell">
<div style="width:14px;"></div>
</div>
</div>
<div class="table-row">
<div class="table-cell"></div>
<div class="table-cell">
<!-- This is the content of the LEFT table -->
<img src="http://oasis-church-nj.com/wp-content/uploads/2011/04/easter-egg.jpg" style="height:100px; width:500px;" />
</div>
<div class="table-cell"></div>
</div>
<div class="table-row">
<div class="table-cell"></div>
<div class="table-cell"></div>
<div class="table-cell"></div>
</div>
</div>
</div>
CSS
.table {
display: table;
overflow: hidden;
border-collapse: collapse;
}
.table-row {
display: table-row;
}
.table-cell {
display: table-cell;
word-break: all;
overflow: hidden;
}
#containerLeft {
background: #F0F;
position: relative;
display: block;
overflow: hidden;
margin: 0px 0px 15px 0px;
}
#containerRight {
background: #FF0;
position: relative;
min-width: 220px;
max-width: 400px;
width: 35%;
height: 300px;
float: right;
margin: 0px 0px 15px 15px;
}
예는 여기에서 찾을 수 있습니다. HTML 테이블을 더 넓고 작게 만들면 오른쪽 테두리가 사라집니다. http://jsfiddle.net/gqmJ9/
테두리? 마젠타 색 배경색 스트립을 의미합니까? –
표를 9 셀, 3 행 3 열로 봅니다. 중앙 셀은 "내용"이지만 외부 8 셀은 "경계"로 정의됩니다. 최종 코드의 원인으로 멋진 상자를 보여주는 이미지로 채워질 것입니다. – Jeffrey