在你的 css 中使用媒体查询,这里是 4 个断点 css 查询。
这是 jsfiddle http://jsfiddle.net/yeyene/MfKzU/1/
HTML
<table id="myTable" width="100%" border="1">
<tr>
<td>Nothing change</th>
<td class="col_1">Hide data < 959px</td>
<td class="col_2">Hide data < 767px</td>
<td class="col_3">Hide data < 599px</td>
<td class="col_4">Hide data < 479px</td>
</tr>
<tr>
<td>Left alone</td>
<td class="col_1">aaa</td>
<td class="col_2">bbb</td>
<td class="col_3">ccc</td>
<td class="col_4">ddd</td>
</tr>
<tr>
<td>Left alone</td>
<td class="col_1">aaa</td>
<td class="col_2">bbb</td>
<td class="col_3">ccc</td>
<td class="col_4">ddd</td>
</tr>
</table>
CSS
html, body{
margin:0;
padding:0;
}
#myTable {
float:left;
border:1px solid #dfdfdf;
border-collapse:collapse;
width:100%;
font-size:12px;
}
/* #Tablet (Portrait)
================================================== */
/* Note: Design for a width of 768px */
@media all and (min-width: 768px) and (max-width: 959px) {
td.col_1{
display:none;
width:0;
height:0;
opacity:0;
visibility: collapse;
}
}
/* #Mobile (Landscape)
================================================== */
/* Note: Design for a width of 600px */
@media all and (min-width: 600px) and (max-width: 767px) {
td.col_2{
display:none;
width:0;
height:0;
opacity:0;
visibility: collapse;
}
}
/* #Mobile (Landscape)
================================================== */
/* Note: Design for a width of 480px */
@media all and (min-width: 480px) and (max-width: 599px) {
td.col_3{
display:none;
width:0;
height:0;
opacity:0;
visibility: collapse;
}
}
/* #Mobile (Portrait)
================================================== */
/* Note: Design for a width of 320px */
@media all and (max-width: 479px) {
td.col_4{
display:none;
width:0;
height:0;
opacity:0;
visibility: collapse;
}
}