html - How to display a table that changes number of columns based on if mobile -
i have table example
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
and on mobile want display important columns like:
| 1 | 2 | 3 | 4 |
i've tried looking @ responsive design re-order whole table rather showing part of table.
i'm using ionic uses angular , haven't seen example on stackoverflow.
you use media queries max-width value , hide table cells class of hide-mobile;
.hide-mobile { background: silver; } @media (max-width: 600px) { .hide-mobile { display: none; } } div { margin-top: 10px; margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid red; width: 600px; }
<div>if window smaller width of red line cells gray background disappear</div> <table> <tr> <td class="hide-mobile">lorem ipsum dolor sit amet, consectetur.</td> <td>lorem ipsum dolor.</td> <td>corrupti, ipsum eligendi.</td> <td>nobis, placeat, aut?</td> <td class="hide-mobile">lorem ipsum dolor.</td> <td>lorem ipsum dolor.</td> </tr> <tr> <td class="hide-mobile">veniam, commodi omnis voluptatem rem! consectetur?</td> <td>lorem ipsum dolor.</td> <td>sed, esse, quidem.</td> <td>officiis repellat, cumque.</td> <td class="hide-mobile">maxime, et, blanditiis.</td> <td>tempore, molestias, totam.</td> </tr> <tr> <td class="hide-mobile">reiciendis blanditiis voluptas tenetur possimus, quas.</td> <td>lorem ipsum dolor.</td> <td>eos, modi, illum!</td> <td>distinctio, iusto rerum!</td> <td class="hide-mobile">autem, ex, dolor.</td> <td>quae, quod, quasi.</td> </tr> <tr> <td class="hide-mobile">ratione doloremque distinctio porro, explicabo voluptatibus.</td> <td>lorem ipsum dolor.</td> <td>quod, doloribus, accusantium!</td> <td>totam, voluptate, sapiente!</td> <td class="hide-mobile">quasi maiores, qui.</td> <td>dicta, labore, eum.</td> </tr> <tr> <td class="hide-mobile">dolor harum eligendi, unde facere similique!</td> <td>lorem ipsum dolor.</td> <td>expedita, doloremque reprehenderit.</td> <td>quasi, alias, nemo.</td> <td class="hide-mobile">voluptatibus, quos, a!</td> <td>debitis, hic corporis!</td> </tr> <tr> <td class="hide-mobile">recusandae ipsa repudiandae quod quaerat ducimus.</td> <td>lorem ipsum dolor.</td> <td>delectus, impedit, error.</td> <td>iste, illum, dicta.</td> <td class="hide-mobile">voluptatibus, autem, itaque!</td> <td>iure, error iusto.</td> </tr> <tr> <td class="hide-mobile">explicabo ut qui deserunt laboriosam provident.</td> <td>lorem ipsum dolor.</td> <td>accusamus, neque, laborum.</td> <td>distinctio repudiandae, eaque!</td> <td class="hide-mobile">repellendus maiores, ipsa.</td> <td>quasi, vero, tenetur!</td> </tr> <tr> <td class="hide-mobile">temporibus sapiente iusto quasi. cupiditate, reprehenderit.</td> <td>lorem ipsum dolor.</td> <td>vero, libero sapiente?</td> <td>inventore, molestiae, ut!</td> <td class="hide-mobile">ipsam, molestias, iusto.</td> <td>nesciunt, ab recusandae.</td> </tr> </table>
Comments
Post a Comment