Tips for displaying scrollbar on the side panel

Looking to create a view ads page but struggling with Bootstrap? Need help incorporating a scrollbar in the filters for easier browsing of content? The goal is to keep the filter fixed while users scroll through ads in the main section.

<head>
<link
rel="stylesheet" href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="72101d1d06010600130232475c415c41">[email protected]</a>/dist/css/bootstrap.min.css"/>
</head>
<body>

<div class="container-fluid">
  <div class="row">
    <div
      class="col-md-3 col-lg-2 d-md-block bg-light sidebar collapse"
      id="sidebar"
    >
      <form class="needs-validation" novalidate>
        <div class="mb-3">
          <label for="view">View</label>
          <select class="form-control" id="view" name="view">
            <option value="gallery">Gallery</option>
            <option value="list">List</option>
          </select>
        </div>
        <div class="mb-3">
          <label for="sort">Sort</label>
          <select class="form-control" id="sort" name="sort" value="">
            <option value="newest">Newest</option>
            <option value="oldest">Oldest</option>
          </select>
        </div>
        <div class="mb-3">
          <input
            type="checkbox"
            class="form-check-input"
            id="has_images"
            name="has_images"
          />
          <label class="form-check-label" for="has_images">Has Images</label>
        </div>
         
        <div class="d-flex justify-content-between">
          <button type="submit" class="btn btn-outline-primary">Reset</button>
          <button type="submit" class="btn btn-primary">Apply</button>
        </div>
      </form>
    </div>
    <main class="col-md-9 col-lg-10 px-md-4">
      <div class="d-flex justify-content-end pt-3 pb-2 mb-3 border-bottom">
        <button
          class="btn btn-secondary d-md-none"
          type="button"
          data-toggle="collapse"
          data-target="#sidebar"
        >
          Toggle Filters
        </button>
      </div>
    </main>
  </div>
</div>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
<script
      src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="47252828333433352637077269746974">[email protected]</a>/dist/js/bootstrap.bundle.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>

</body>
</html>

Refer to the image below: https://i.sstatic.net/cwadKc2g.png

Attempts were made to use "position=fixed" on the sidebar, but encountered issues with overlap between the main ads and the sidebar.

Answer №1

This solution appears to be effective.

.side-bar {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 16.66667%;
  overflow-y: auto; 
  padding-top: 1rem; 
}
/* Ensure the main content begins after the side-bar */
main {
  margin-left: 16.66667%; /* Equal width as the side-bar */
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Show or hide a div element in AngularJS based on a selected option without utilizing a controller or model

Just diving into Angular JS and looking to toggle the display of div based on select option without involving controller or model. <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script> <select class= ...

Generate a spider's web beneath an hour element using CSS

I am attempting to create a spider's web effect under an <hr /> element, but I am encountering difficulties with the circular parts. Instead of using SVG, I want to style the hr element so that the web appears under all instances of it, without ...

The slice() function is displaying the correct output in the console, but the string is not being updated in the <td>

I am facing an issue where the console displays the expected substring, but the original string in the HTML remains unchanged. The goal is to truncate any long text within each table <td>. It's important to note that I'm specifically avoi ...

Insert stand-alone text into text field for Sudoku viewing

I am currently working on creating a Killer Sudoku grid with jigsaw bold lines inside regular 3x3 squares. Each cell needs to display a number and an operation at the top right. I have set up a table with each cell as a textbox. However, I'm strugglin ...

What can I do to ensure that this is responsive across all devices?

Hey there! I need some assistance with making my Chat site/application responsive. I'm not too familiar with CSS, but I'm the sole developer on this project, so I'm trying my best. I initially designed the site in Photoshop and then started ...

Tips for making items move to the next line after floats

Here is the code snippet I'm working with: <div>First</div> <div class="second">Second</div> <a>Alink</a> div{ display: block; float:left; } .second{ clear:right; } http://jsfiddle.net/cg4gj/ I am ...

Is it possible to design a div with a curved lower edge?

As I am developing a website, I have a question regarding the styling of a div element. Is it achievable using just HTML5, CSS3 (and possibly JavaScript) to create a div with a curved bottom like the one shown below: https://i.sstatic.net/ZfM0a.png Or wo ...

Guide to aligning text vertically in a column alongside an image using Bootstrap 5

I have been using the Bootstrap 5.3.2 grid system for most of my website. I am trying to create a layout with an image on the left and text on the right. However, I am facing an issue with aligning the text vertically in the column. Is there a way to achie ...

Array with radio buttons in multiple dimensions

Currently, I am implementing a functionality with radio buttons in my project. <input type="radio" value="1" name="report[1][AP]"> <input type="radio" value="2" name="report[1][AP]"> <input type="radio" value="1" name="report[1][DCI]"> ...

Using either the <h1> or <p> tag within my <div> element disrupts the entire layout

Whenever I add a heading tag or paragraph tag within my div, it causes the content to drop down the screen significantly. I am unsure of the cause and feel a bit overwhelmed by it. I attempted to wrap the <h1> tag in a <div>, as shown below: & ...

Obtain text content from a web page document using C/C++

Is there a way to retrieve Arabic text from a specific section of a webpage using C/C++? For instance, if we have the URL for this article on Wikipedia, can we isolate the main body content (as shown in the image) and ignore other page elements such as he ...

Add formatting to specific list items within the Ui Fabric Nav element

https://i.sstatic.net/BcCbj.png Please take a look at the provided screenshot. In the list, some items are marked with an eye icon to indicate that they are hidden and not important for the user's immediate attention. However, this icon seems to have ...

Is Skrollr's performance affected when images are included?

I've recently been experimenting with the skrollr plugin to build a parallax webpage optimized for iOS. I've noticed that when I solely use text, the scrolling effect is smooth and quick. However, as soon as I add a background image using CSS or ...

Resolving Discrepancies in SVG Rendering on MacOS between iOS and Chrome

I am trying to create a title that adjusts its size based on the screen width without breaking into multiple lines. I am currently using an SVG technique to achieve this effect. Here is the code snippet: <!DOCTYPE html> <html lang="en"> <h ...

Applying Compiled CSS file in Node.js using Express and SASS not working as expected

Recently, I've delved into utilizing NodeJS with Express to serve my pug files. In addition, I decided to incorporate the "express-sass-middleware" to compile and serve the scss/css files in my project. While everything seems to be functioning as expe ...

The same bootstrap column code shows varying behavior

This week, I delved into learning HTML with the goal of creating my own website using bootstrap. However, I encountered a perplexing error - code that should display two pieces of text on the same line is behaving inconsistently for seemingly identical sni ...

Design the appearance of page buttons distinct from select buttons

I am currently working on styling my paging buttons differently from the select buttons. However, the selector I am using for the select buttons is also being applied to the paging buttons: .gridView tr td a{} /* The gridView class has been assigned to th ...

In the case of a PDF being in landscape orientation, the full width of the document is not utilized despite the width being set to

Even though I have specified the width of the Header table to be 100% and applied a margin-right of 1cm for PDF reports with landscape orientation, the table is not taking up the full width. However, when my PDF report has portrait orientation, the header ...

Issue encountered while attempting to insert data into the database using a form. SQLSTATE[42S22]

Encountering an issue while attempting to extract data from a form and insert it into a table named objects within a database named test. Upon submitting the form with entered information, an error is triggered: Fatal error: Uncaught PDOException: ...

Identify the specific button that triggers a JavaScript function

Currently, I am working on an admin page that displays a list of posts using EJS for template rendering engine. <table> <tr> <th>Name</th> <th>Description</th> </tr> <% projects.for ...