Alignment Woes in Bootstrap Designs

I'm seeking assistance regarding the alignment of content on my webpage. The content is not aligning properly with the sidebar and footer, and I'm unsure how to proceed. The page should have a left margin to avoid touching the sidebar, and the footer should be at the bottom. I will provide an image of the current state of my page. Any help would be greatly appreciated.

* {
  box-sizing: border-box;
}

html {
  display: block;
}

 /* STYLING FOR SCROLL BAR */
body::-webkit-scrollbar { 
  width: 0.30rem;
}

body::-webkit-scrollbar-track { 
  background: #212429;
}
body::-webkit-scrollbar-thumb { 
  background:#fc3218 ;
}
/* SCROLL BAR STYLING ENDS */


.lateral-nav {
    position:absolute;top:0;left:0;width:100px;background:#fafafc;height:100vh;display:flex;flex-direction:column;justify-content:flex-start;align-items:center; 
    }
      img {
      width:60px;height:45px;margin-top:5px;
    }

    .lateral-nav a {
        writing-mode:vertical-lr;text-orientation:mixed;margin:10px 0;}


    .navbar {
      margin-top:10px;

    }

    /* NAV BAR STYLING */
    .my-nav{
      position: absolute;
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 15px;
      }

    .navbar-light .navbar-nav .nav-link {
      color: white;
    }

    ....

/* Footer styling starts */

....
/* Footer styling ends */

/* Footer End */
html,
body {
   margin:0;
   padding:0;
   height:100%;
}
#container {
   min-height:100%;
   position:relative;
}
#header {
   background:#ff0;
   padding:10px;
}
#body {
   padding:10px;
   padding-bottom:60px;   /* Height of the footer */
}
#footer {
   position:absolute;
   bottom:0;
   width:100%;
   height:60px;   /* Height of the footer */
   background:#6cf;
}
<link ..... 
      
<!DOCTYPE html>
<html lang="en">
    <head>
        <!-- Required meta tags -->
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

        <!-- Bootstrap CSS -->
        ....

    <footer class="mainfooter" role="contentinfo">
  <div class="footer-middle">
  <div class="container">
    <div class="row">
      <div class="col-md-3 col-sm-6">
        <!--Column1-->
        <div class="footer-pad">
          <h4>Heading 1</h4>
          ....
        </div>
      </div>
      <div class="col-md-3 col-sm-6">
        <!--Column2-->
        ....

<!-- Footer Ends -->

   <!-- Optional JavaScript -->
    <!-- jQuery first, then Popper.js, then Bootstrap JS -->
    ....
</body>
</html>

Answer №1

In the comments, I mentioned that there were some missing elements that needed correction, so I addressed those first.

If you see a horizontal scroll bar in the snippet below, it's because your CSS is setting padding: 0 to the body. Changing it to padding: 8px should resolve the issue.

Additionally, I included the following CSS at the bottom of the existing styles:

 body{
  max-width: calc(100vw - 19px);
  min-height: 100vh;
}
#container{
  width:100%;
}
header, main{
  max-width:100%;
}
nav{
  max-width: calc(100% + 5px);
  width: calc(100% + 5px) !important; /**** Important needed to over<rite bootstrap class ***/
}
main{
  margin-left: 100px;
}
footer{
 width: calc(100% - 85px);
 margin-left: 100px;
 margin-right: -15px;

}

After that, I moved the footer out of the div id="container" and added the footer class to the footer element.

DEMO (try it full screen)

(CSS snippet here)
(Linking CSS and JS scripts 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

Uncover the hidden message in a string encoded for JavaScript

This encoded HTML code is intended for use in a JavaScript function <div class=\"ProductDetail\"><div style=\"width:780px\">\r\n\t<div class=\"baslik\" style=\"margin: 0px; padding: 5px 10px ...

Utilizing HTML5 and JQuery for Drag and Drop functionality: Moving an image to populate a linked webpage within an iframe upon dropping

Looking to add a drag and drop feature to my project. The left pane will contain tiles that act as images, while the right pane will display iframes. My goal is to drag a tile from the left pane and drop it onto an iframe on the right pane. The twist is th ...

Steps to create a submit button that is linked to a URL and includes an image

I'm attempting to convert my submit button into an image that, when clicked, redirects to another page. Currently, the submit button is functional but lacks the desired image and href functionality. <input type="submit" name="submit" alt="add" o ...

What could be causing the issue of CSS Styles not being applied to an Angular 2 component with Vaadin elements?

Currently, I am immersed in the tutorial on Vaadin elements using Angular 2 that I stumbled upon here In section 5.3, Styles are applied to the app.component.ts as shown below import { Component } from [email protected]/core'; @Component({ select ...

The animation on my jQuery script seems to be malfunctioning

I'm encountering an issue with a div element that is partially off the screen and should move out when a button is clicked. I've shared my script here, but it seems to not work as intended when the button is pressed. The visualization in jsfiddle ...

Regular expression for selecting characters and numbers in jQuery using a selector

Can someone help me figure out how to select all IDs like this: r1 r2 r3 etc. and not the other IDs like helloWorld I attempted using the CSS selector with jQuery but I'm having trouble understanding how. I tried $('#r[0-9]') but it didn& ...

What method can be used to incorporate Google Places API into a .js file without using a <script> element?

As I delve into the Google Places API documentation, I noticed that they require the API be loaded in this format: <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&libraries=places"></script> Is ...

Utilizing anchor tags within the title attribute

I am trying to display a message in a tooltip that includes a link. Here is the HTML code I have used: <div class="col-xs-2" data-toggle="tooltip" title="Please click <a href='www.google.com'>here</a> for more information.">&l ...

What is the best method for locating X-Path for elements inside a frameset?

I need help creating a test case for Selenium because I am struggling to locate elements on my website. The issue seems to be related to the fact that my site uses an HTML frame set. When I try to select all links using Firebug: //a I do not get any res ...

Modifying properties through JavaScript is not possible

I created an HTML form and I'm trying to change the attributes of a div and a button but for some reason, it's not working <form> <button type='button' id='other'>Sub</button> <select id="prop"> &l ...

The JavaScript code for summing two numbers is not functioning as expected

My HTML code takes a user input number, performs a calculation using a formula, and displays the output. The chosen input is inserted into the formula, and the result is added to the original number. However, there seems to be an issue with adding decimal ...

Transfer a document to a php server using AJAX and jQuery in place of a traditional form

Is there a way to use AJAX for uploading files in PHP without reloading the page or performing additional functions? I want to keep it simple. Any suggestions? <form action="upload.php" method="post" enctype="multipart/form-data"> <label st ...

Is there a way to automatically update the child option when the parent option is altered?

I am attempting to modify the child option based on the parent option selection, similar to how it works in Bootstrap. ` <div class="wrap-input100 input100-select bg1"> <span class="label-input100">Indus ...

Show varying HTML headers on the initial page as opposed to subsequent pages

Currently, I am utilizing an HTML to PDF Library known as Nreco for converting HTML Pages into PDF format. The task at hand involves implementing a consistent header on every page, with the exception of the first page that should display the Recipient Addr ...

Capturing images on Android devices through the camera option using HTML input file type

Having an issue with an LG G2 Android device running version 4.4.2 and the default browser. I'm currently using this tag to allow users to upload images from their devices to the server: {<input type="file" accept="image/*;” />} When I clic ...

What are the best strategies to perfectly insert an image within a div, ensuring that no background color is visible?

Is there a way to fix the issue of a white background appearing at the bottom of this div? .flexbox-item_one { display: inline-block; width: 200px; margin: 10px; background-color: white; box-shadow: 5px 5px 5px; overflow: hidden; } .flexb ...

Create a JavaScript and jQuery script that will conceal specific div elements when a user clicks on them

Within my navigation div, there exists another div called login. Through the use of JavaScript, I have implemented a functionality that reveals additional divs such as login_name_field, login_pw_field, register_btn, do_login_btn, and hide_login upon clicki ...

Image positioned above the text in the mobile layout following the text

Can the layout be adjusted so that on desktop, the image is on the right and text on the left in the lower box, but on mobile, the image appears above the text? https://i.sstatic.net/hbPxa.png I understand that placing the image tag after the text tag in ...

The jQuery plugin functions smoothly when running on localhost, but it causes issues with the background image when deployed on the web

I created a compact plugin to show a cookie message. While testing it on my local machine, everything functioned smoothly without affecting any web pages. However, once I transferred the files to the server, I encountered issues such as: A background ima ...

Centering an image on a webpage using CSS

Here is the code I am using for displaying my image: return <div class="imgContainer"><img src={broomAndText} alt="broomAndText" /></div> In my css file, I have included the following styling: .imgContainer { tex ...