너무 어렵지는 않지만 정의하지 않는 한 콘텐츠의 크기가 정확하게 지정되지 않습니다. 당신이 콘텐트와 폭 변화 것을 볼 수 있습니다 중간과 마지막 셀의 내용을 바꿀 경우
<table width="100%" cellpadding="0" cellspacing="0" style="border:none;">
<tr>
<td width="150" valign="top">This is a fixed width column, it's only 50 pixels wide</td>
<td valign="top">This is a variable width column that has a lot of content</td>
<td valign="top">This is also a variable width column as well</td>
</tr>
</table>
이 table
사용하면 넓은으로 중간 열을 볼 수 있습니다.
<table width="100%" cellpadding="0" cellspacing="0" style="border:none;">
<tr>
<td width="150" valign="top">This is a fixed width column, it's only 50 pixels wide</td>
<td valign="top">This is also a variable width column as well</td>
<td valign="top">This is a variable width column that has a lot of content</td>
</tr>
</table>
이제 너비가 고정 된 셀에서 표를 중첩하여 재생할 수도 있습니다. 다음 예제에서는 가운데 열입니다. 이렇게하면 마지막 열의 너비가 커지고 공간을 차지할 수 있습니다.
<table width="100%" cellpadding="0" cellspacing="0" style="border:none;">
<tr>
<td width="150" valign="top">This is a fixed width column, it's only 50 pixels wide</td>
<td valign="top">
<table width="130" cellpadding="0" cellspacing="0" style="border:none;">
<tr>
<td>This is a fixed width table's content inside of a nested table</td>
</tr>
</table>
</td>
<td valign="top">This is a variable width column that has a lot of content and should push the boundaries</td>
</tr>
</table>
이렇게하면 표 안에 액체 내용을 처리하는 방법에 대한 몇 가지 전략이 있습니다. UPDATE - - * *
**
아마도 미안, 그 잘못 읽었다.
표는 항상 가장 넓은 셀에서 열 너비를 가져옵니다. 다양한 너비의 내용을 가진 여러 행이있는 경우 열은 모두 열 내의 가장 넓은 셀 너비를 상속합니다. 따라서 테이블의 열을 고정 너비로 만들려면 고정 너비의 내용을 갖거나 고정 너비의 요소에 내용을 래핑해야합니다.
gmail, Google 리더 및 많은 온라인 이메일 클라이언트는 유사한 접근 방식을 사용하여 왼쪽에 고정 너비 탐색 기능을 사용하고 렌더링 영역을 사용자 브라우저로 확대시킵니다.
<table width="100%" cellpadding="0" cellspacing="0" style="border:none;">
<tr>
<td valign="top">
<table width="50" cellpadding="0" cellspacing="0" style="border:none;">
<tr>
<td>This is a fixed width column, it's only 50 pixels wide</td>
</tr>
</table>
</td>
<td valign="top">
<table width="130" cellpadding="0" cellspacing="0" style="border:none;">
<tr>
<td>This is a fixed width table's content inside of a nested table</td>
</tr>
</table>
</td>
<td valign="top">This is a variable width column that has a lot of content and should push the boundaries</td>
</tr>
</table>
일반적으로 CSS에서는이 작업을 수행하지만이 방법을 사용하면 표 셀의 너비를 정의하지 않습니다. 그들은 콘텐츠에서 너비를 상속 받게됩니다. 내용에 고정 너비가없는 세 번째 열은 사용자의 웹 브라우저 너비와 함께 커지고 유동적입니다.
가치가있는 점은 2013 년 이후로 몇 가지 CSS 업데이트가 있지만이 문제가 모두 해결된다는 것입니다.하지만 여전히 필요는 없다고 생각합니다. CSS 멀티 컬럼 레이아웃, CSS 유연한 박스 레이아웃 및 CSS 그리드 레이아웃은 모두이를 구현할 수있는 다양한 솔루션을 제공합니다. – TylerH