Step-by-step guide on building a vertical sidebar on the left using Bootstrap

I am interested in adding a vertical navigation bar to my page using bootstrap. Specifically, I would like it to be positioned on the left side between my header and footer. Additionally, there is some text that needs to remain in a fixed position. What is the most effective way to achieve this? Any suggestions?

Below are the HTML/CSS codes I have implemented:

    <!DOCTYPE html>
    <html lang="en">
    <head>
      <title>xxx</title>
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width, initial-scale=1">

      <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
      <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css">
      <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
      <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
      <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

 <style type="text/css">
       html {
          position: relative;
          min-height: 100%;
        }
        body {
          margin-bottom: 160px;
              }

        footer {
          position: absolute;
          bottom: 0;
          left:0;
          width: 100%;
          height: 140px;
          background-color:#555;
            }

          hr {
          height: 1px;
          background-color:#555;
          margin-top: 30px;
          margin-bottom: 30px;
          width: 100%;
        }

    .custom{
    color: white;
    background-color:black;
    height: 85px;
    }

    </style> </head>
    <body>

    <div class="container-fluid">
    <nav class="navbar navbar-default">

              <div class="navbar-header">
              <a class="navbar-brand" href="#">Test</a>
              </div>

              <div id="navbar" class="navbar-collapse collapse">
                <ul class="nav navbar-nav navbar-right">
                  <li class='active'><a href="#">Home</a></li>
                  <li><a href="#"> Team</a></li>  
                  <li><a href="#">Help</a></li>
                 </ul></div></nav>

    <div class="row">
    <div class="col-sm-12 custom">
    <h2><strong>Test -test-test</strong></h2>
    <h4>bla bla bla</h4>
    </div></div><BR>


    <div class="container">
    <p class="text-justify">Some textSome textSome textSome textSome textSome textSome textSome textSome textSome text</p><BR>
    <p class="text-justify">Some textSome textvvSome textSome textSome textSome textSome textSome textSome textSome textSome textSome text</p><BR>
    <p class="text-justify">Some textSome textSome textSome textSome textSome textSome textSome textSome textSome text</p><BR>
    <p class="text-justify">Some textSome textSome textSome textSome textSome textSome textSome textSome textSome text</p><BR>
    <p class="text-justify">Some textSome textSome textSome textSome textSome textSome textSome textSome textSome text</p><BR>
    <p class="text-justify">Some textSome textSome textSome textSome textSome textSome textSome textSome textSome textSome text</p><BR>
    <p class="text-justify">Some textSome textSome textSome textSome textSome textSome textSome textSome textSome text</p><BR>
    </div>

    <footer>
      <div class="container">
      <div class="row">
      <div class="col-sm-12 text-center">
      <image style="height:80px" src="/footer_image/Logo.gif"></image>
      </div></div></div> </footer>

    </body>
    </html>

Thank you, Clarissa

Answer №1

Utilize the column classes available on Bootstrap here or for version 4 here

Check out my example on this link, it will give you a good understanding.

<div id="header" class="col-lg-12">
    <p>Header/Nav</p>
</div>

<div id="sideLeft" class="col-lg-2">
    <p>Sidebar Left</p>
</div>

<div id="body" class="col-lg-8">
    <p>All your main content should go here.</p>
</div>

<div id="sideRight" class="col-lg-2">
    <p>Sidebar Right</p>
</div>

<div id="footer" class="col-lg-12">
    <p class="white-text">Footer</p> 
</div>

CSS:

#header {
    height: 50px;
    background-color: #ccc;
}
#body {
    height: 500px;
    background-color: #eee;
}
#footer {
     height: 300px;
     background-color: #3f3f3f;
}

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

Issues with nav menu not expanding below header on medium-sized screens when using Bootstrap 4

I am having trouble getting the navigation menu to load from the bottom on medium-sized browser screens. When I click the hamburger icon in Firefox browser, the menu should appear below the header. It displays correctly when the browser width is very smal ...

What could be causing the div to not respond to ngAnimate?

Recently, I encountered an issue with adding animations to a list of <div>'s in my webapp. After incorporating ngAnimate into the app.js file and including ng-animate="'animate'" in the <div>, I was disappointed to find that the ...

How to redirect a form submission using jQuery

Is there a way to make this code work upon submission instead of on click? This is the form I am working with: <form> <input type="radio" name="value" value="http://google.com"><span>Google</span><br> <input type= ...

Exploring Javascript's Timing Functions: SetInterval() and ClearInterval()

Hi there, I am currently working on developing an interval timer that allows users to set the number of rounds, working interval length, and resting interval duration. For instance, if a user inputs 30 seconds for work, 10 seconds for rest, and decides on ...

I am struggling to increase the width of my input bar and center-align it

Below is the CSS class I've created to ensure that all elements remain centered on the user's screen. container: { display: "flex", position: "absolute", top: 0, left: 0, height: "100%&qu ...

The code functions correctly on JSfiddle, however it is not executing properly on my website

When I tried to implement the code from this jsfiddle link: http://jsfiddle.net/mppcb/1/ on my website (), it didn't work as expected: Here is the HTML code snippet: <form id="myform" novalidate="novalidate"> <input type="text" name="fi ...

Unable to access the vertical scrollbar in the browser due to a fullscreen fixed bootstrap modal

Bootstrap 4 is being utilized in my current project, where I have made modifications to the modal style to achieve a fullscreen effect. The following CSS code showcases the changes: .modal.show { display:flex!important; flex-direction:column; justi ...

Using DataTables with jQuery, the CSS background color setting does not function properly

I've attempted various solutions, however, it still doesn't seem to be working. I am attempting to present data from a database in a table using the jQuery DataTables plugin. Everything appears to be correct technically, but the background color ...

Check to see if a value is present in JavaScript and proceed with submitting the form

I have a situation where I am trying to capture the browser location and post it to another page. The problem I'm facing is that JavaScript takes some time to retrieve the browser location, causing the form to be submitted before the location is obtai ...

The hover effect fails to function properly after altering the background color. The default color setting is transparent

<button class="button-main slide">Slide Left</button> .button-main{ color: black; outline: none; background: transparent; border: none; letter-spacing: 0.0625em; padding: 8px 10px; text-transform: uppercase; font: b ...

Is there a way to create a button in an HTML project that will launch the user's email client?

Looking for some guidance on coding a homepage with HTML and CSS as I navigate my way through the world of web development. Take a look at this screenshot for reference: In the Jumbotron section, you'll notice that I have integrated a couple of boot ...

Organize your Flex-Items

Suppose there is a Flex-Box #X containing 4 Flex-Items #Y1 ... #Y4 that need to be arranged in the following manner: https://i.sstatic.net/NDix8.png If the output medium is smaller than 60em, the flex-items should be positioned like this: https://i.sstatic ...

Using NodeJS with Jade to handle a dynamic number of blocks

As I dive into NodeJS development, a challenge has presented itself... In my project, there is a main template called layout.jade that sets up the top navigation bar using Bootstrap on every page. This specific application focuses on music, where each art ...

Is it possible to display a pop-up caption in the mobile view?

When I added a caption to my image, it only appeared when hovering over the symbol in the image. However, this feature doesn't work on mobile or tablet due to the image size. How can I make the caption appear when the image is clicked on mobile/tablet ...

Angular2: Leveraging click events to manage CSS classes on elements

I am currently developing a web app using Angular 2. I'm facing an issue where the active element should receive an extra CSS class when clicked, but adding the ":active" CSS attribute with a custom class doesn't work as expected. The ":focus" pr ...

Utilizing Carousel Functionality in Angular 4

I've added a Carousel to one of my components. Bootstrap has been correctly imported (verified by testing a bootstrap button). The active image, slider icons, and navigation icons at the bottom are all visible. However, the images are not sliding and ...

Can you show me how to recreate a 502 gateway timeout error?

Looking for suggestions on how to create a page that exceeds 600 seconds to load? Any tips on triggering a 502 gateway timeout error would be helpful as well. ...

The HTML video will only be visible when the window is resized

I recently attempted to incorporate the vide.js jQuery extension into my project in order to implement a video background within a div element. Below is the code snippet for the video div: <div id="header" data-vide-bg="mp4: graphics/videos/identity.mp ...

Press a button to generate an image inside a specified div element

I've been struggling with this particular issue and have attempted various solutions, but there seems to be an error in my implementation as it's not functioning correctly. My goal is simple: I want to be able to click a button and have an image ...

Removing a row from a table does not delete it completely

Disclaimer: While I am aware of SQL Injection, my main focus is on getting the function completed. I'm having an issue with my delete button not removing the row from my SQL table. products-one-time.php https://i.sstatic.net/gxPOu.png This is the o ...