Full height sidebars with adjustable scrolling bars

Currently, I am working on an Angular application that features a fixed bootstrap navbar at the top and a sidebar container with a header and a scrollable list of content.

To achieve this layout, I am using specific CSS classes:

.main-wrapper {
    height: 100%;
    width: 100%;
    position: absolute;
    top: 0px;
    left: 0px;
    padding-top: 50px;
}

.sidebar-container {
    height: 100%;
    position: fixed;
    padding: 0px;
    margin-top: -50px;
    padding-top: 50px;
    border-right: 1px solid #ddd;
}

.sidebar-header {
    position: relative;
    padding: 15px;
    border-bottom: 1px solid #ddd;
}

.sidebar {
    height: 100%;
    position: relative;
    overflow-y: scroll;
}

Here is the corresponding HTML code snippet:

<div class="main-wrapper">      
    <div class="sidebar-container col-xs-3">
        <div class="sidebar-header">
            ...
        </div>
        <div class="sidebar">
            ...
        </div>
    </div>
    <div class="main-view col-xs-9 pull-right">
        ...
    </div>
</div>

You can access a minimal working example in the following jsFiddle link:

https://jsfiddle.net/j1tuw3vj/8/

The issue I'm facing is that the sidebar extends beyond the bottom of the page, causing the last element in the list to be hidden. Adjusting the margin or padding of the sidebar is challenging because the height of the sidebar header may vary in different views.

Answer №1

Modify:

/* Adjustable sidebar. */
.sidebar {
    height: 85%;
    position: relative;
    overflow-y: scroll;
}

The issue is: The sidebar height was set to 100% with a relative position.

View it Live.

UPDATE:

Add the following line in your CSS file.

.nav-pills li:last-child{
margin-bottom:80px;
}

See Updated Version Here.

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

Tips for aligning the button and search bar in the center:In order

Currently still learning HTML, I'm facing an issue with centering a button and a search bar that are positioned beside each other. Despite trying multiple methods, I haven't been successful in achieving the desired centered layout while keeping t ...

Provide the email address to use on the forum

Is there a way to code an email address in HTML that will be invisible and undetectable by forums? Thank you in advance. I'm looking for a more advanced solution like this one! <h>mariaburkke76</h><h><h><h><h>< ...

Steps for eliminating the thick border around <thead> and <tfoot> elements in Bootstrap

Is there a way to remove the thick border on the <thead> and <tfoot> elements in Bootstrap 4 that seems a bit unnecessary? I found a forum post addressing this issue for Bootstrap 5, but unfortunately, the fix didn't work for me since I a ...

What is the best way to achieve a full-width navbar with the scrollbar positioned below it?

I have a similar code to what's shown here The menu is fixed, but the scrollbar seems to be appearing from the right of the navbar What I want is for the scrollbar to start below the menu instead see image example here ...

Tips for aligning a cluster of floating buttons at the center in Vuetify:

This is the code I am currently working with: <v-container height="0"> <v-row align="center" justify="center"> <v-hover v-slot:default="{ hover }" v-for="(option, index) in options" ...

Is it possible to eliminate a character from text that lacks html tags or CSS classes using CSS?

I need assistance in removing characters that are not associated with any HTML tag, CSS id or class. Specifically, I want to eliminate the "--" from the provided code snippet below. Can someone please guide me on how to achieve this? <span cl ...

Watching a VideoJS video does not pause even after closing a Bootstrap modal

I am struggling with a modal on my website that contains a video. Even when I close the modal by clicking outside of it or using the close button, the video continues to play in the background. I have tried all the solutions I could find on stackoverflow ...

Utilizing HTML onClick to pass a PHP variable as a parameter

After going through many similar examples, I am still struggling to get this code working. This is what I currently have: echo('<td colspan="3" style="background-color:#005673; text-align:right; padding: 4px 0px;"> <button class="btnT ...

Utilize Javascript to Populate Form Fields Based on "Selected Name"

I am currently facing a challenge in using javascript to automatically populate a form, specifically when it comes to setting the value for the country field. <form action="/payment" method="post" novalidate=""> <div class="input_group"> ...

conceal the offspring from the guardians, not the offspring

Could you please assist me with this situation... <li id="4331">Region <ul> <li id="4332">Asia</li> <li id="6621">Europe</li> </ul> </li> I have a query when I click on the Reg ...

The function toggleClass() is malfunctioning

The .toggleClass() method seems to only be adding the "class" attribute to my selection, resulting in: <div id="toggle" class> ... rather than: <div id="toggle" class="on"> ... I've been trying to solve this issue for about 2 hours now ...

What is the best method for transforming bullet points into a horizontal list?

Is there a way to display disc bullet points in a horizontal list? I've encountered an issue where setting display: inline; in CSS prevents the class definition list-style-type: disc from working. My workaround involves manually inserting disc bulle ...

The browser is struggling to interpret the incorrect HTML content

I am looking for a way to create a function that can retrieve account data from my database and organize it in a user-friendly HTML table where users can make selections and modifications. The code I have so far is as follows: $.ajax({ url: "./dat ...

The JavaScript script to retrieve the background color is malfunctioning

I am currently working on developing a highlighting feature for an HTML table that will dynamically change the row colors on mouseover. Below is the code snippet I have been using, but it seems to be experiencing some issues. Any assistance would be greatl ...

Issues arising when checking the responsiveness of the navigation bar on display

Recently, I encountered an issue with the navigation bar on my webpage. It contains an image logo on the left and three links on the right. The problem arises when I test the responsiveness using different devices on Chrome; the navigation bar resizes and ...

What is the Bootstrap method for incorporating these two lines into the code?

Can someone please help me figure out how to use Bootstrap to create a header with a TITLE that has blank borders on the top and bottom? Is it possible to achieve this design with Bootstrap? I'm new to this, so any guidance would be greatly appreciate ...

Issues with passing form data from an HTML label control to the controller are causing challenges

This particular type of HTML form control does not transmit form data. <form action="index.php?action=createNewCustomer" method="POST"> <fieldset> <label class="field" for="firstName">First Name:</label> <input type="text ...

Launch a popup modal box from within an iframe and display it in the parent window

I'm facing a challenge with opening a modal dialog in the parent page from an iframe. The button to open the modal dialog resides in the iframe, but the modal div is located on the parent page. Here's a snippet of my parent page: <html xmlns ...

Tips for designing a horseshoe-inspired meter using CSS

  I want to create a horseshoe-shaped gauge using CSS that resembles the image below:     My attempt involved creating a circle and cutting off the bottom, similar to the technique demonstrated in this fiddle: http://jsfiddle.net/Fz3Ln/12/   Here& ...

Loop through the ng-content elements and enclose each one within its own individual nested div

Although it is currently not supported, I am curious to know if anyone has discovered a clever solution to this problem. In my current setup, I have a parent component with the following template: <dxi-item location='after' class="osii-item- ...