HTML - add horizontal scroll to table

7 points
Created by:

In this short article, we would like to show how to add a horizontal scroll bar to the table using CSS.

The solution wraps table element with div element using that has added overflow-x style.

Quick solution:

// ONLINE-RUNNER:browser;

<!doctype html>
    table {
      border-collapse: collapse; 

    table, td, th {
      border: 1px solid black;


  <div style="overflow-x: scroll; width: 400px;">
    <table style="width: 600px;">
          <td>some problem title 1</td>
          <td>some problem title 2</td>


HTML table

Native Advertising
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂