How to fixed one column and scrollable other column or columns in Bootstrap ?
Bootstrap provides several built-in features to the users. This makes development faster and smoother. However, in some cases, external CSS and jQuery has to be implemented to the web page’s coding in order to give it a personalized touch. Usually, the Bootstrap grid is used to divide the web-page into 12 equal columns. These columns can be grouped together to create wider columns. The columns are responsive in nature. This means that the columns will cover the whole screen on big screens, but will stack on top of each other on small screen devices.
When the webpage is divided into two equal columns, and the content inside the columns starts to overflow, the columns become scrollable. However, by doing some small modifications, the columns can be fixed. This article will demonstrate how to keep one column fixed, and the other column scrollable.
Syntax:
- To fixed the column make not scrollable.
<div class="col-sm-6 col-2 fixed-top one">
- To make the column scrollable.
<div class="col-sm-6 offset-sm-6 two">
Below example illustrates the above approach:
Example: You can run the code by hitting the run button so you can see the right column is scrollable but left is not.
<!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href= <script src= </script> <script src= </script> <script src= </script> <style> .one{ background-color:lightgreen; } .two{ background-color:green; } .container-fluid{ font-size:120%; } </style> </head> <body> <div class="container-fluid"> <div class="row"> <div class="col-sm-6 col-2 fixed-top one"> <h2>Fixed</h2><br> It is a good platform to learn programming. It is an educational website. Prepare for the Recruitment drive of product based companies like Microsoft, Amazon, Adobe etc with a free online placement preparation course. The course focuses on various MCQ's & Coding question likely to be asked in the interviews & make your upcoming placement season efficient and successful. Also, any geeks can help other geeks by writing articles on the GeeksforGeeks, publishing articles follow few steps that are Articles that need little modification/ improvement from reviewers are published first. To quickly get your articles reviewed, please refer existing articles, their formatting style, coding style, and try to make you are close to them. Adobe etc with a free online placement preparation course. The course focuses on various MCQ's & Coding question likely to be asked in the interviews & make your upcoming placement season efficient and successful. Also, any geeks can help other geeks by writing articles on the GeeksforGeeks, publishing articles follow few steps that are Articles that need little modification/ improvement from reviewers are published first. To </div> <div class="col-sm-6 offset-sm-6 two"> <h2>Scrollable</h2><br> It is a good platform to learn programming. It is an educational website. Prepare for the Recruitment drive of product based companies like Microsoft, Amazon, Adobe etc with a free online placement preparation course. The course focuses on various MCQ's & Coding question likely to be asked in the interviews & make your upcoming placement season efficient and successful. Also, any geeks can help other geeks by writing articles on the GeeksforGeeks, publishing articles follow few steps that are Articles that need little modification/ improvement from reviewers are published first. To quickly get your articles reviewed, please refer existing articles, their formatting style, coding style, and try to make you are close to them. Adobe etc with a free online placement preparation course. The course focuses on various MCQ's & Coding question likely to be asked in the interviews & make your upcoming placement season efficient and successful. Also, any geeks can help other geeks by writing articles on the GeeksforGeeks, publishing articles follow few steps that are Articles that need little modification/ improvement from reviewers are published first. To </div> </div> </body> </html> |
Output:

Recommended Posts:
- Split a text column into two columns in Pandas DataFrame
- Join two text columns into a single column in Pandas
- How to change column to row on small display in Bootstrap 4 ?
- How to make horizontal scrollable in a bootstrap row?
- How to create five equal columns in Bootstrap ?
- How to use Bootstrap to align labels with content into 4 columns ?
- CSS | column-gap Property
- HTML | DOM Column Object
- CSS | column-fill Property
- CSS | column-width Property
- CSS | grid-column-gap Property
- CSS | column-count Property
- CSS | column-span Property
- CSS | grid-column-end Property
- CSS | grid-column Property
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


