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>


Alternative titles

  1. HTML / CSS - add horizontal scroll to table (overflow-x: scroll)
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

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.

❤️💻 🙂