The sidebar's bottom gets concealed beneath the page's window

I seem to be facing an issue with the sidebar where the bottom section is not visible. Interestingly, when I remove the top navbar, everything works fine. Despite my efforts to troubleshoot and apply various solutions, none of them seem to work for me.

Does anyone have any ideas on how to resolve this issue?

Here is a screenshot depicting the problem, showcasing the bottom of the scrollbar hidden beneath the page window: https://i.sstatic.net/5VCZ8.png

Below is the code snippet in question:

html,
    body {
      height: 100%;
      overflow: hidden;
    }
    .scrollable {
      overflow-y: auto;
      height: 100vh;
    }
<script src="https://cdn.jsdelivr.net/npm/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet"/>
<nav class="navbar navbar-expand-lg bg-body-white shadow bg-white z-2">
      <div class="container-fluid">
        <a class="navbar-brand text-primary" href="#">
          Shopping System
        </a>

        <div
          class="collapse navbar-collapse justify-content-end"
          id="navbarText"
        >
          <span class="navbar-text text-dark me-4">Welcome, User Name</span>
        </div>
      </div>
    </nav>
    <!-- main content -->
    <div class="container-fluid">
      <div class="row">
        <!-- left content -->
        <div class="col-4">
          <div class="row">
            <!-- fixed sidebar -->
            <div class="col-4 border-end">
              <nav class="nav flex-column">
                <a
                  class="nav-link active mb-3 text-dark border-bottom"
                  id="v-pills-home-tab"
                  data-bs-toggle="pill"
                  data-bs-target="#v-pills-home"
                  role="button"
                  aria-controls="v-pills-home"
                  aria-selected="true"
                  >Form 1</a
                >

                <a
                  class="nav-link mb-3 text-dark border-bottom"
                  id="v-pills-profile-tab"
                  data-bs-toggle="pill"
                  data-bs-target="#v-pills-profile"
                  role="button"
                  aria-controls="v-pills-profile"
                  aria-selected="false"
                  >Form 2</a
                >
              </nav>
            </div>

            <!-- scrollable sidebar -->
            <div class="col border bg-info p-0">
              <!-- <div class="scrollable"></div> -->
              <div class="tab-content p-2 scrollable" id="v-pills-tabContent">
                <div
                  class="tab-pane fade show active"
                  id="v-pills-home"
                  role="tabpanel"
                  aria-labelledby="v-pills-home-tab"
                  tabindex="0"
                >
                  ...
                </div>
                <div
                  class="tab-pane fade"
                  id="v-pills-profile"
                  role="tabpanel"
                  aria-labelledby="v-pills-profile-tab"
                  tabindex="0"
                >
                  ...
                </div>
              </div>
            </div>
          </div>
        </div>
        <!-- right content -->
        <div class="col p-0">
          <div class="card border-0">
            <img
              src="https://ibb.co/K905DBS"
              style="width: 100%"
              class="card-img rounded-0 border-0"
              alt="map"
            />
          </div>
        </div>
      </div>
    </div>

Answer №1

It seems like your .scrollable class is being set to fill the height of the entire viewport without considering the height of the nav element.

I suggest referring to the documentation for the calc() function in CSS. To address this issue, you can use the following CSS:

nav {
    /* If you're using Bootstrap, this height is likely set by another class */
    height: 50px;
}

.scrollable {
    /* Subtract the preset height of the header */
    height: calc(100vh - 50px);
}

Answer №2

If your scroll bar is mysteriously missing, it might be due to the overflow: hidden; property applied to the <nav> element, causing it to exceed the height of the page.

To resolve this, I adjusted the nav by setting it as position:absolute; width:100%; to position it above the .row section. Additionally, a new class .row-ur-boat has been added with the property .padding-top:55px;

Feel free to give this a try :)

<!DOCTYPE html>
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <style>
        html,
        body {
            height: 100%;
        }
        .p-2 {
            position: inherit;
            overflow: auto;
            height: inherit;
        }
        .col.border.bg-info.p-0,
        .row,
        .col-4.border-end,
        .col-4,
        .container-fluid {
            height: inherit;
        }
        .navbar.navbar-expand-lg.bg-body-white.shadow.bg-white.z-2 {
            position: absolute;
            width: 100%;
        }

        .row-ur-boat {
            padding-top: 55px;
        }
    </style>
</head>
<html>
    <body>
        <script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="d7b5b8b8a3a4a3a5b6a797e2f9e4f9e7fab6bba7bfb6e4">[email protected]</a>/dist/js/bootstrap.bundle.min.js"></script>
        <link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="caa8a5a5beb9beb8abba8affe4f9e4fae7aba6baa2abf9">[email protected]</a>/dist/css/bootstrap.min.css" rel="stylesheet" />
        <nav class="navbar navbar-expand-lg bg-body-white shadow bg-white z-2">
            <div class="container-fluid">
                <a class="navbar-brand text-primary" href="#">
                    Shopping System
                </a>

                <div class="collapse navbar-collapse justify-content-end" id="navbarText">
                    <span class="navbar-text text-dark me-4">Welcome, User Name</span>
                </div>
            </div>
        </nav>
        <!-- main content -->
        <div class="container-fluid">
            <div class="row row-ur-boat">
                <!-- left content -->
                <div class="col-4">
                    <div class="row">
                        <!-- fixed sidebar -->
                        <div class="col-4 border-end">
                            <nav class="nav flex-column">
                                <a class="nav-link active mb-3 text-dark border-bottom" id="v-pills-home-tab" data-bs-toggle="pill" data-bs-target="#v-pills-home" role="button" aria-controls="v-pills-home" aria-selected="true">Form 1</a>

                                <a class="nav-link mb-3 text-dark border-bottom" id="v-pills-profile-tab" data-bs-toggle="pill" data-bs-target="#v-pills-profile" role="button" aria-controls="v-pills-profile" aria-selected="false">Form 2</a>
                            </nav>
                        </div>

                        <!-- scrollable sidebar -->
                        <div class="col border bg-info p-0">
                            <!-- <div class="scrollable"></div> -->
                            <div class="tab-content p-2 scrollable" id="v-pills-tabContent">
                                <div class="tab-pane fade show active" id="v-pills-home" role="tabpanel" aria-labelledby="v-pills-home-tab" tabindex="0">
                                    /*Content here*/
                                </div>
                                <div class="tab-pane fade" id="v-pills-profile" role="tabpanel" aria-labelledby="v-pills-profile-tab" tabindex="0">
                                    /*Content here*/
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- right content -->
                <div class="col p-0">
                    <div class="card border-0">
                        <img src="https://ibb.co/K905DBS" style="width: 100%;" class="card-img rounded-0 border-0" alt="map" />
                    </div>
                </div>
            </div>
        </div>
    </body>
</html>

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

Utilizing CSS to align all HTML form elements at the center

Is it possible to centrally align all form labels and input fields by using CSS? If so, what would be the approach for a form where the label text is displayed vertically above the input field? #fieldset label { display: block; } #fieldset input ...

Break up a list into separate paragraphs and style each word using individual CSS

I have a user-generated paragraph that consists of a list of words separated by commas, such as "dog, cat, hamster, turtle." I want to be able to individually assign attributes to each word in the list. Check out this image for reference In the example i ...

Utilizing the dynamic pairing of Three.js and CSS3 to bring life to animated 3D objects

I am currently working on a project that involves creating 3D Lego elements and assembling them into a figure using animation. I have successfully modeled the elements in Blender and exported them as .obj/mlt files without any issues. However, when it come ...

Voice recognition feature in the latest version of Chrome on Android devices

When using a PC with Chrome 25 (non beta), I see a microphone icon that prompts for input when clicked. After speaking, my alert call is successfully executed. However, on a Galaxy Note smartphone with Chrome 25 and an Android 4.04 operating system, the sa ...

Creating a div that overlays other divs using html and css

On websites like Facebook and LinkedIn, there is a search box where you can type in your query and the results will display below it, covering up other content on the page. This functionality is shown in the screenshot below from LinkedIn. I am curious ab ...

What is the best method for caching inline SVG in web browsers?

Over the years, SVGs have remained popular due to their scalability. One key advantage of inline SVG is the ability to manipulate it with CSS and JS. Additionally, using the <use> tag allows for referencing the original element when repeating the sam ...

Embedding content within various ng-template elements

I'm currently working on developing a button component (app-button) that can utilize multiple templates based on the parent component using it. <div class="ds-u-margin-left--1 ds-u-float--left"> <ng-container *ngTemplateOutlet="icon">< ...

Persistent hover state remains on buttons following a click event

In my current project, I am dealing with a form that has two distinct states: editing and visible. When the user clicks on an icon to edit the form, two buttons appear at the bottom - one for saving changes and one for canceling. Upon clicking either of th ...

Tips for dynamically incorporating input forms within AngularJS

I am trying to dynamically change the form inputs using ng-bind-html. However, I am only able to display the label and not the text box on the DOM. The content inside ctrl.content will depend on the values received from the server. Important Note: The ...

Is it possible to equalize the size of these list elements?

I'm new to working with HTML and CSS. My goal is to have navigation buttons that are all the same size, occupying one third of the width of the panel they are placed in. I have access to the original code but can only make adjustments rather than comp ...

Issue with Custom CSS Class Not Displaying Correctly

I have implemented some unique CSS styles on a group of posts. You can view the site here. Upon inspecting the CSS classes of the posts, you will notice that the last two classes are .floats and .colThree. .colThree is being applied correctly with no issu ...

What is the process for implementing a third-party component in my web application?

After some experimentation, I've discovered that it's necessary to include the link to the css files in the header and then mention the link to the js files before the closing tag. However, I encountered difficulties when trying to use a compone ...

Encountering Error 500 with Jquery Min.Map File

ERROR: GET request to http://domain.com/assets/js/jquery-1.10.2.min.map returned a 500 Internal Server Error Can anyone help me figure out what's causing this error? I checked the log files in /var/log/error but couldn't find any information. T ...

JavaScript layout: Thymealf

I have a unique thymeleaf template like so: <body> <div id="layout"> <!-- Menu toggle --> <a href="#menu" id="menuLink" class="menu-link"> <!-- Hamburger icon --> <span>& ...

Adding class names dynamically to div elements using jQuery can enhance the interactivity and styling of a webpage

I need to dynamically add a class name to multiple divs using jQuery. Specifically, I have 10 divs in mind. <div class="sec"></div> <div class="sec"></div> <div class="sec"></div> <div class="sec"></di ...

Guide to creating a continuous loop for CSS3 animation

I'm looking to create a setup that can play on repeat, but I'm not very familiar with jQuery. Can anyone lend a hand with this? Check out the DEMO here $('.title1').fadeIn('fast', function() { $('div').addClass ...

Assertion error: 1 does not match the expected value of 6

I am faced with a challenging test that requires me to write code that will pass successfully. However, no matter what I try, all I get is the following error messages: "Failed asserting that 1 matches expected 6" when I return 6 and "Too few arguments t ...

Table design with fixed left columns and header that adjust to different screen sizes

After reading various articles on this issue, I have been unable to find a solution. Most of the examples I've come across feature tables with a single row for the header and rows that consist of just one row, similar to a calendar. My table, on the o ...

The child elements are stacking vertically despite implementing inline-block

I have a container with 100% width. I am trying to position three divs inside it next to each other, all with the same height as the parent. Unfortunately, despite setting the display property to inline-block, they are not aligning properly and appear sta ...

Align the text on the same horizontal line

I have been struggling with this issue for hours. Here is my Header.js <div className="navbar-inner"> <h2>Text1</h2> <h3>Text2</h3> </div> This is the content of my Header.css: .navbar-inner { ...