Open In App
Related Articles

How to make horizontal scrollable in a bootstrap row?

Improve Article
Save Article
Like Article

Here is the task to make horizontally scrollable in a bootstrap row.
It can be done by the following approach:


  • Making all the div element in inline using display: inline-block; property
  • Adding the scroll bar to all the div element using overflow-x: auto; property.
  • white-space: nowrap; property is used make all div in a single line.

Example :

<!DOCTYPE html>
<html lang="en">
    <title>How to make horizontal 
      scrollable in a bootstrap row?</title>
    <meta charset="utf-8">
    <meta name="viewport" 
          content="width=device-width, initial-scale=1">
    <link rel="stylesheet" 
        /* The heart of the matter */
        .horizontal-scrollable > .row {
            overflow-x: auto;
            white-space: nowrap;
        .horizontal-scrollable > .row > .col-xs-4 {
            display: inline-block;
            float: none;
        /* Decorations */
        .col-xs-4 {
            color: white;
            font-size: 24px;
            padding-bottom: 20px;
            padding-top: 18px;
        .col-xs-4:nth-child(2n+1) {
            background: green;
        .col-xs-4:nth-child(2n+2) {
            background: black;
        <div class="container">
            <h1 style="text-align:center;color:green;"
            To make horizontal scrollable in a bootstrap row?
            <div class="container horizontal-scrollable">
                <div class="row text-center">
                    <div class="col-xs-4">1</div>
                    <div class="col-xs-4">2</div>
                    <div class="col-xs-4">3</div>
                    <div class="col-xs-4">4</div>
                    <div class="col-xs-4">5</div>
                    <div class="col-xs-4">6</div>
                    <div class="col-xs-4">7</div>


Last Updated : 04 Oct, 2019
Like Article
Save Article
Similar Reads
Related Tutorials