3 개 열 (앨범 노래를 표시하는 데 사용)이있는 테이블이 있습니다. 번호, 트랙 제목 및 아티스트. Number와 Artist의 컬럼을 작게 유지하고 Title이 컬럼의 대부분의 공간을 배치 할 수있게하고 싶었습니다. 모바일 용으로 반응 형으로 만들고 싶었습니다.하나의 테이블 열만 반응 형으로 변환하는 방법
white-space: nowrap
, overflow: auto
으로 올바르게 만들고 테이블 td에 max-width
을 추가했습니다. 대형 디스플레이가있는 데스크탑에서는보기에 좋지만 모바일 화면에서는 에 사용 된 width:100%
이 적용되지 않습니다. 테이블이 화면의 한계를 초과하기 때문입니다.
작은 화면에 전체 표를 표시하고 수정하려면 어떻게해야합니까? @media
으로 만 가능합니까?
수행 작업은 여기에 있습니다 :
table {
width: 100%;
}
table th {
background: #E4E4E4;
line-height: 23px;
padding-top: 6px;
color: #626262;
letter-spacing: 0.05em;
text-transform: uppercase;
font-size: 11px;
border: 1px solid #DBDBDB;
}
table td {
font-size: 13px;
line-height: 22px;
background: #F7F7F7;
border-top: 1px solid #F3F3F3;
white-space: nowrap;
overflow: auto;
max-width: 300px;
}
table td,
table th {
text-align: left;
padding: 3px 20px;
}
<table cellpadding="0" cellspacing="0">
<tbody>
<tr>
<th>Nº</th>
<th class="largura-min">Title</th>
<th>Artist</th>
</tr>
<tr>
<td>1</td>
<td>I need this column placing most of this space/Superlong String Superlong String Superlong String Superlong String Superlong String Superlong String Superlong String Superlong String Superlong String Superlong String</td>
<td>ARTIST</td>
</tr>
<tr class="even">
<td>2</td>
<td>TITLE 2</td>
<td>I NEED A SMALLER ARTIST SPACE/SUPERLONG ARTIST SUPERLONG ARTIST SUPERLONG ARTIST SUPERLONG ARTIST SUPERLONG ARTIST SUPERLONG ARTIST</td>
</tr>
</tbody>
</table>