The sidebar refuses to fill the entire page, no matter how many times I adjust the positioning

In my app, I am looking to implement a sidebar that will house the main URLs and brand name along with a navigation bar for other pages such as FAQ and about us.

However, I'm encountering an issue with positioning the sidebar absolutely. During my research, I came across this solution to prevent overlapping of the bars.

https://i.sstatic.net/ndKZJ.png

The problem primarily lies with the sidebar layout as shown in the image above.

Here's the HTML structure:

<div class="row">
    <div class="col-md-2 bg-dark">
       <nav class="navbar navbar-light bg-dark" id="sidebar">
           <ul class="navbar-nav mr-auto">
               <div class="brand-panel">
                   <li class="nav-item active">
                       <a class="navbar-brand" href="{% url 'home' %}"><h5>Sentizer <small class="one" > Beta</small></h5></a>
                   </li>
               </div>
               <li class="nav-item active">
                   <a class="nav-link" href="{% url 'patients:dashboard' %}">Dashboard</a>
               </li>
               <li class="nav-item">
                    <a class="nav-link" href="{% url 'patients:patients_list' %}">Patients</a>
               </li>
               <li class="nav-item">
                    <a class="nav-link" href="{% url 'accounts:tickets' %}">Tickets</a>
               </li>
               <li class="nav-item">
                    <button type ="button" class="button1 nav-link" data-toggle="modal" data-target="#modalContactForm">Feedback</button>
               </li>
           </ul>
       </nav>
    </div>

  <div class="col-md-10">
      <div class="row">
           <div class="col-md-12 px-0">
               <nav class="navbar navbar-expand-md navbar-light bg-light sticky-top" id="top-nav1" >
                    <div class="container-fluid">
                         <form class="form-inline" action="{% url 'patients:patient_search' %}" method="GET" >
                             <input class="form-control mr-sm-2" id="sebar" type="text" size="45%" placeholder="Search" aria-label="Search" name="q">
                             <button class="btn btn-outline-primary btn-sm" type="submit" ><i class="material-icons">search</i></button>
                         </form>
                         <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
                                <span class="navbar-toggler-icon"></span>
                         </button>

                         <div class="collapse navbar-collapse" id="navbarSupportedContent">
                               <ul class="navbar-nav ml-auto">
                                    <li class="nav-item">
                                        <a class="nav-link" href="{% url 'about' %}">About us</a>
                                    </li>
                                    <li class="nav-item">
                                        <a class="nav-link" href="{% url 'faq' %}">FAQ</a>
                                    </li>
                                     <li class="nav-item">
                                     </li>
                                    {% if user.is_authenticated %}
                                    <li class="nav-item dropdown">
                                         <a href="#" class="dropdown-toggle nav-link" data-toggle="dropdown">{{request.user.first_name}} {{request.user.last_name}}<b class="caret"></b></a>
                                        <ul class="dropdown-menu">
                                            <li class="dropdown-item">
                                                <a class="nav-link" href=" {% url 'accounts:details' pk=request.user.pk %}">Profile</a>
                                            </li>
                                            <li class="dropdown-item text-nowrap">
                                                <a class="nav-link" href="{% url 'accounts:logout' %}">Sign out</a>
                                            </li>
                                        </ul>
                                    </li>
                                    <li class="nav-item">
                                        <a href="#" id="searchtoggl"><i class="fa fa-search fa-lg"></i></a>
                                    </li>
                                    {% else %}
                                     <li class="nav-item text-nowrap">
                                         <a class="nav-link trigger-btn" href="#loginModal" data-toggle="modal">Login</a>
                                     </li>
                                    {% endif %}
                               </ul>
                                </div>
                            </div>
                        </nav>
                    </div>
                </div>

I attempted adjusting the position of

<nav class="navbar navbar-light bg-dark" id="sidebar">
, but it seems to be dependent on the background div preceding it, resulting in no changes. How can I resolve this issue and is there a more effective way to arrange the bars on the page without any overlap?

Answer №1

To make your 'app container' (specifically the first div#app) extend to screen height, you can use height: 100vh. Test it out on a full page display:

#app {
  height: 100vh;
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">

<div id="app" class="row">
  <div class="col-md-2 bg-dark">
    <!-- sidebar -->
    <nav class="navbar navbar-light bg-dark" id="sidebar">
      <ul class="navbar-nav mr-auto">
        <div class="brand-panel">
          <li class="nav-item active">
            <a class="navbar-brand" href="{% url 'home' %}">
              <h5>Sentizer <small class="one"> Beta</small></h5>
            </a>
          </li>
        </div>
        <li class="nav-item active">
          <a class="nav-link" href="{% url 'patients:dashboard' %}">Dashboard</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="{% url 'patients:patients_list' %}">Patients</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="{% url 'accounts:tickets' %}">Tickets</a>
        </li>
        <li class="nav-item">
          <button type="button" class="button1 nav-link" data-toggle="modal" data-target="#modalContactForm">Feedback</button>
        </li>
      </ul>
    </nav>
  </div><!-- sidebar -->

  <div class="col-md-10">
    <div class="row">
      <div class="col-md-12 px-0">
        <!-- navbar -->
        <nav class="navbar navbar-expand-md navbar-light bg-light sticky-top" id="top-nav1">
          <div class="container-fluid">
            <form class="form-inline" action="{% url 'patients:patient_search' %}" method="GET">
              <input class="form-control mr-sm-2" id="sebar" type="text" size="45%" placeholder="Search" aria-label="Search" name="q">
              <button class="btn btn-outline-primary btn-sm" type="submit"><i class="material-icons">search</i></button>
            </form>
            <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
              <span class="navbar-toggler-icon"></span>
            </button>

            <div class="collapse navbar-collapse" id="navbarSupportedContent">
              <ul class="navbar-nav ml-auto">
                <li class="nav-item">
                  <a class="nav-link" href="{% url 'about' %}">About us</a>
                </li>
                <li class="nav-item">
                  <a class="nav-link" href="{% url 'faq' %}">FAQ</a>
                </li>
                <li class="nav-item">
                </li>
                {% if user.is_authenticated %}
                <li class="nav-item dropdown">
                  <a href="#" class="dropdown-toggle nav-link" data-toggle="dropdown">{{request.user.first_name}} {{request.user.last_name}}<b class="caret"></b></a>
                  <ul class="dropdown-menu">
                    <li class="dropdown-item">
                      <a class="nav-link" href=" {% url 'accounts:details' pk=request.user.pk %}">Profile</a>
                    </li>
                    <li class="dropdown-item text-nowrap">
                      <a class="nav-link" href="{% url 'accounts:logout' %}">Sign out</a>
                    </li>
                  </ul>
                </li>
                <li class="nav-item">
                  <a href="#" id="searchtoggl"><i class="fa fa-search fa-lg"></i></a>
                </li>
                {% else %}
                <li class="nav-item text-nowrap">
                  <a class="nav-link trigger-btn" href="#loginModal" data-toggle="modal">Login</a>
                </li>
                {% endif %}
              </ul>
            </div>
          </div>
        </nav>
      </div><!-- navbar -->
    </div>

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

Rails pagination will only show the link to the current page

Is there a way to show only the current page link with the << Previous link hidden when on the first page and next >> link hidden when on the last page? It should look like this: On the first page: 1 | next >> On the last page (with 4 ...

Display the <select> options panel in the form of an accordion instead of a dropdown menu

Hello, I am attempting to display a list of tag options as an accordion instead of a dropdown menu, but unfortunately, it's not working the way I want it to. Here is what I have: <select onclick="document.getElementById('options');" onC ...

The parent div will not accommodate two nested divs

I'm having an issue with two divs inside a parent div not being contained within the container when I inspect the page, even though I've wrapped the div around the other 2 divs. My goal is to apply attributes to the parent div instead of each in ...

Embedding SVG with Company Name

I'm struggling to align text with an SVG logo within a mdbootstrap navbar. Despite trying all the solutions provided in this thread position svg, none seem to be working for me. I am currently learning about SVG and not well-versed in using CSS. My c ...

The single controller can now showcase various notification styles for operations such as insertion, updating, or error handling

I need to display notifications to the user based on three different scenarios using a controller. When data is successfully inserted When data is successfully updated In case of an error For each scenario, I want to show a different style of notificati ...

What is the process for making a button that only consists of text?

Is there a way to design a button that displays text like a hyperlink, but still maintains the <button> characteristics? ...

Styling does not affect an Angular component that is injected into an iframe

I am facing an issue with styling in an iframe when trying to append my own angular component. Despite various attempts, I have been unsuccessful in getting the styling to apply to the component within the iframe. Upon loading the iframe, I use JavaScript ...

Steps for creating a hovering effect that overlays a circular image by 50%

I'm trying to implement a feature on my website where an overlay appears when a user hovers over their display picture. However, I'm facing a challenge as I want the overlay to only cover half of the circle, not the entire photo. After research ...

Inserting line breaks in the data retrieved through AJAX

Utilizing ajax to transfer data from a sophisticated custom field wysiwyg editor. Within the markup provided, I am specifically addressing the div with the 'bio' class. However, upon receiving the data, it is consolidated into one large paragraph ...

PHP - Sending selected option value to index.php to add new user

In my nuevo.php file, which translates to 'new client', I have set up a form to insert data into a MySQL database. The form includes various input fields such as: <label for="Nombre">Nombre : </label><br/> <input width="50" ...

How can I update the value of one select tag when another select tag is changed?

My web page contains two select options as shown below. https://i.sstatic.net/kmDv3.jpg There are two select options labeled as #age1 and #age2, with age values ranging from 18 to 30. I want to ensure that when a user selects an age from #age1, the minim ...

Positioning a text directly next to an image that are both hyperlinked to the same webpage located in the center of the image

When viewing my site on a mobile device, I want to have an image with text next to it that both link to the parent menu. However, I'm facing an issue with the text not aligning properly (it should be centered within the picture height but appears at t ...

Toggling forms with HTML <select> elements: A step-by-step guide

In the process of creating a web application, I am faced with the task of registering users based on their specific category. To accomplish this, I have incorporated a combo-box where users can indicate their user type. My objective is to display an appro ...

Ways to avoid a bootstrap column from wrapping onto a new line when the parent width is decreased

https://i.sstatic.net/gKdAN.png I attempted to decrease the form width by applying padding on both sides of the form using 'px-5'. However, when I implemented this change, the column holding the '#lastName' input shifted to a new line. ...

Align the input element perfectly in both horizontal and vertical positions

I've been trying to center the <input> element within a black <div>, but my attempts have not been successful. Can you tell me what I'm doing incorrectly? html, body { margin: 0; padding: 0; height: 100%; } header { backgro ...

What is the best way to load a targeted quantity of content on a social media platform's webpage?

Building a social media style platform, I attempted to simulate multiple users being active by opening several tabs. To my surprise, when checking the task manager, I found my Apache web server was consuming around 20% of CPU. After some debugging and scri ...

Comparing the benefits of using ajax to switch pages versus the traditional method of loading pages

Is it advisable to intercept all internal links and load the target page using ajax? The new history API in HTML5 allows for changing the URL in the address bar as well. Are there any drawbacks to this approach compared to the old traditional way of lett ...

Is there a way to set the content to be hidden by default in Jquery?

Can anyone advise on how to modify the provided code snippet, sourced from (http://www.w3schools.com/jquery/tryit.asp?filename=tryjquery_hide_show), so that the element remains hidden by default? <!DOCTYPE html> <html> <head> <scrip ...

What is the best way to enhance the visibility of the navigation items in my Bootstrap 4 navbar?

While working with Bootstrap 4, I encountered an issue where the text navigation items in the navbar were appearing semi-transparent regardless of my efforts to adjust the code. The dark blue background color of the navbar was causing the opacity to make i ...

Error: The document object is not defined when attempting to access it within a

<script type="module" src="/scripts/navbar.js"></script> <script> async function fetchContent(e) { e && e.preventDefault(); const response = await fetch('https: ...