Expanding/Collapsing the Side Navigation Bar and Adjusting the Container Size

I'm currently working on creating a dashboard using Bootstrap that includes a side navigation bar. However, when the navbar is open, the content in the container gets pushed to the right and off the screen. I want the entire container to be resized to fit the screen regardless of whether the navbar is open or collapsed. Is there a specific Bootstrap CSS class that can be added to the body or container to address this issue?

    <body>
        <div id="wrapper">
        <div class="overlay"></div>

        <!-- Sidebar -->
        <nav class="navbar navbar-inverse navbar-fixed-top" id="sidebar-wrapper" role="navigation">
            <ul class="nav sidebar-nav">
                <li class="sidebar-brand">
                    <a href="#"><img src="assets/img/logo.png"></img></a>
                </li>
                <li>
                    <a href="overview.html"><span class="icon icon-home"></span>Overview</a>
                </li>
                <li>
                    <a href="#"> <span class="icon icon-suitcase"></span>Account Management</a>
                </li>
                <li>
                    <a href="#"><span class="icon icon-bar-graph"></span>Demand Planning</a>
                </li>
                <li>
                    <a href="#"><span class="icon icon-box"></span>Inventory Planning</a>
                </li>

                <li>
                    <a href="#"><span class="icon icon-light-bulb"></span>Vendor Management Invetory</a>
                </li>
                <li>
                    <a href="dashboards.html"><span class="icon icon-calculator"></span>Dashboards</a>
                </li>
                <li>
                    <a href="#"><span class="icon icon-text-document">Reports</a>
                </li>
            </ul>
        </nav>
        <!-- /#sidebar-wrapper -->

        <!-- Page Content -->
        <div id="page-content-wrapper">
            <button type="button" class="hamburger is-closed" data-toggle="offcanvas">
                <span class="hamb-top"></span>
                <span class="hamb-middle"></span>
                <span class="hamb-bottom"></span>
            </button>
            <div class="container">
                <div class="dashhead">
      <div class="dashhead-titles">
        <div class="dashhead-toolbar">
            <form class="navbar-form" role="search">
                <div class="input-group">
                <input type="text" class="form-control" placeholder="Search" name="srch-term" id="srch-term">
                </div>
            </form>
        </div>
        <h3 class="dashhead-title">Overview</h3>
      </div>    
    </div>
                <ul class="nav nav-bordered mt-4 mt-md-2 mb-0 clearfix" role="tablist">
      <li class="nav-item" role="presentation">
        <a href="#traffic" class="nav-link active" role="tab" data-toggle="tab" aria-controls="traffic">Summary</a>
      </li> 
    </ul>

    <hr class="mt-0 mb-5">

    <div class="tab-content">
      <div role="tabpanel" class="tab-pane active" id="traffic">
        <div class="row text-center m-t-md">
          <div class="col-lg-4"</div>
          </div>
          </div>
          </div>

         <style>
#sidebar-wrapper {
    z-index: 1000;
    left: 235px;
    width: 0;
    height: 100%;
    margin-left: -235px;
    overflow-y: auto;
    overlay-x: hidden;
    background: #252D3A;
    -webkit-transition: all 0.5s ease;
    -moz-transition: all 0.5s ease;
    -o-transition: all 0.5s ease;
    transition: all 0.5s ease;}

#wrapper.toggled #sidebar-wrapper {
    width: 235px;}

#wrapper.toggled #page-content-wrapper {
    position: absolute;
    margin-right: -235px;}

#page-content-wrapper {
    width: 100%;
    padding-top: 20px;}

#sidebar-nav {
    position: absolute;
    top: 0;
    width: 235px;
    margin: 0;
    padding: 0;
    list-style: none;}
 </style>

Answer №1

Kindly update the css value.

#container.active #content-wrapper {
    position: fixed;
    width: calc(100% - 250px);
    margin-left: 250px;
}

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

Is it possible for images to align vertically instead of horizontally in IE?

Encountering an issue with image alignment in Internet Explorer - they are aligning vertically instead of horizontally, while functioning correctly in all other browsers. Moreover, in IE8 and 7, the images are not being displayed at all. Is there a workaro ...

Increasing the height of nested Bootstrap columns by stretching them out

I am trying to ensure that the first two columns in both the green and violet rows always have the same height. I initially thought of using d-flex align-items-stretch, but it seems like it is not working because those elements are not within the same row ...

The submission of the HTML form is not functioning as expected

Currently, I am delving into the world of coding and experimenting with HTML and PHP. I encountered an issue with a contact form created in HTML - when clicking the submit button, nothing appears on the screen. My immediate goal is to retrieve the entered ...

Align two divs to the left and the other one to the right

Here is the current structure of my code: <div style="height: 100px; Width: 200px;"> <!-- Container --> <div style="float: left; height: 50px; Width: 100px; background-color: ...

My ng-view html is unexpectedly displaying as plain string. What steps should I take to resolve this issue?

Why is my ng-view HTML displaying as plain text? How can I resolve this issue? I have encountered an error, here is the screenshot for reference: Unfortunately, I am unable to upload images at the moment. ...

Having trouble fixing an ASP Classic Script issue with two unnecessary buttons. The script includes two buttons instead of just one, causing confusion and ineff

Hey there, I've encountered a little issue with the ASP Script and the HTML elements inside the body tags. It seems to be generating two buttons instead of just one, which is not what I intended. My main goal here is to remove one of the buttons so th ...

Implementing jQuery to dynamically update a div class based on radio button selections

I have a group of radio buttons with different background colors: <div class="row mb-2"> <div class="col-sm-12 col-md-12 col-lg-6">BG Color<br /> <div class="btn-group"> <input type="rad ...

The HTML select element - Styling the selected item using the option font

Currently, I am working on adding a font dropdown list to a web page. Each option in the dropdown list is styled with the corresponding font it represents like this:- <option value="Arial, Helvetica, sans-serif" style="font-family: Arial,Helvetica,sans ...

SVG path with dynamic elements

Consider the following SVG: <svg xmlns="http://www.w3.org/2000/svg" width="237" height="129" viewBox="0 0 237 129" fill="none"> <path d="M228 1H9C4.58172 1 1 4.58172 1 9V91V104V127L20 111.483L228 112C232.4 ...

Making a dynamic accordion using JavaScript

I am currently coding in Javascript, without utilizing jQuery. Progress so far on the accordion title panel: var accordion = document.createElement('div'); accordion.className = 'panel-group'; accordion.id = 'accordion'; doc ...

Adding text with jQuery

Currently, I am utilizing the Jquery text editor plugin known as JqueryTE. While adding some functions to it, I have encountered a roadblock. Specifically, I am attempting to insert additional text into the source of the textarea but have been unsuccessfu ...

The art of positioning Bootstrap popovers

Does anyone know a way to position a bootstrap popover on the "Right Bottom" of a clicked button instead of the "Right Middle"? The positioning should be dynamic. https://i.sstatic.net/OSQln.png To see the standard code, click here: http://jsfiddle.net/V ...

Issue with Safari causing footer to sporadically appear over overlay

I am encountering a problem with my webpage that has a sticky footer, scrolling content, and an overlay that appears after a few seconds. The issue is specific to Safari on certain devices like iPhone 12-15, where the footer and part of the scrolling conte ...

When using ReactJS, hovering over a row in a table should trigger a change in the background color of the corresponding row in another table with the same index

I need to create a feature where hovering over a row in the first table will highlight a corresponding row in the second table. The highlighting should be based on the index of the hovered row. Here is an example: <div> <table> < ...

What is the best way to adjust the size of several smaller images proportionally to match a larger image positioned below them?

In my project, I am dealing with a situation where I have a large image (such as a map) and several smaller images (representing points on the map) that appear when you hover over certain areas. Right now, I am using absolute positioning to place these s ...

Modifying Stroke color in HTML5 Canvas

I am attempting to create a unique visual effect by drawing a circle resembling a clock using canvas 2d context. The idea is to initially draw the circle in black starting at point p1, and then when I complete a full circle tour it should erase as the colo ...

Changing the hover color of an Angular Material MD Button

<div class="non-active" layout layout-align='space-around center'> <md-button ng-click="$ctrl.widget.type = 'chart'; $ctrl.validateForm()" layout='column' ng-class="{selIcon : $ctrl.widget.type == ' ...

Using JQuery and/or Selenium/WebDriver to ascertain the visible color of elements on a webpage

Is there a way to accurately determine the visible color of page elements? When using JQuery, I can retrieve the background-color of an element with the following code: $('#foo').css('background-color'); However, the background-color ...

Once you address a block using jQuery

$(function(){ $(window).scroll(function () { var scrollVal = $(this).scrollTop(); var adscrtop =$(".header").offset().top // 在 RWD 767以下不作動 if(window.screen.width>767){ if(sc ...

Distinguishing appearances among various web browsers

How come the menus look different in Firefox compared to Chrome, Safari, and IE? I've tried adjusting the CSS but can't seem to get it just right. Any suggestions on how to fix this? In Firefox, there's an overlapping part at the bottom of ...