Tsallaka zuwa abun ciki
Justice Tech School

Responsive Tables

Wide tables break small screens. Wrap them in a div with overflow-x: auto so the table scrolls sideways instead of breaking the page.

Example
<div style="overflow-x:auto; max-width:260px">
  <table border="1" style="border-collapse:collapse; min-width:420px">
    <tr><th>A</th><th>B</th><th>C</th><th>D</th><th>E</th></tr>
    <tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td></tr>
  </table>
</div>

Exercise

Scroll sideways.

overflow-x: ;

Quiz Test

How do you handle a very wide table?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.