What could be causing my bootstrap to overlap?

Hello everyone, I am currently in the process of creating a basic template to enhance the overall design of my website. I recently started utilizing Bootstrap and encountered an issue where my footer is overlapping when I resize my browser to a smaller size, such as on a mobile device.

Does anyone have an idea why this is occurring?

Would you mind taking a look at these images that illustrate the problem: https://i.sstatic.net/MFzdp.png https://i.sstatic.net/IQ5R1.png

As a beginner in Bootstrap, I acknowledge that I may be making a simple mistake that can easily be rectified. Your assistance is greatly appreciated :)

Below is the CSS code I am using:

html, body { height:100% }

nav {
margin: 0;
padding: 0;
}

div {
display: block;
}

.col-centered {
  float: none;
  margin: 0 auto;
}

.center {
margin-left:auto;
margin-right:auto;
margin: 0 auto;
}

.left {
float: left;
}

.right {
float: right;
}

.container {
      width: 100%;
      margin: 0;
      padding: 0;
      height:100%;
      background:red;
}

.content {
  padding: 5rem 1.5rem;
  text-align: left;
  height:90%; 
  width:75%; 
  margin:0 auto;
  background: green;

}

footer {
background: grey;
height:10%; 
width:75%;
margin:0 auto;
}

Here is the main HTML structure:

<div class="container">
<div class="content">
<div class="row">
<div class="col-md-auto col-centered">
<h1>Base Template Title</h1>
<p>Content goes here...</p>
</div>
</div>
</div>
<?php include "footer.php" ?>

EDIT: Apologies for forgetting to include the footer code. If it's necessary for troubleshooting, please feel free to request it.

Thank you for taking the time to review this post!

EDIT 2: Here is the code snippet for the footer:

<footer>
 <div class="row">
   <div class="col-md-auto">
     <p class="float-right"><a href="#">Back to top</a></p>
     <p>&copy; 2017 Company, Inc. &middot; <a href="#">Privacy</a> &middot; <a href="#">Terms</a></p>
   </div>
 </div>
</footer>

Visit the website at:

Answer №1

Get rid of the specified height for .content

.content {
    padding: 5rem 1.5rem;
    text-align: left;
    width: 75%;
    margin: 0 auto;
    background: green;
}

Additionally, eliminate the height property for .container

.container {
    width: 100%;
    margin: 0;
    padding: 0;
    background: red;
}

Answer №2

In order to ensure that the footer.php is properly displayed within the layout, I would suggest wrapping it in a pair of divs and applying a row and col-md-auto class to it. It appears that the footer may currently be styled with an absolute or static display property, which could be causing it to not align correctly with the other elements on the page.

<div class="container">
    <div class="content">
        <div class="row">
            <div class="col-md-auto col-centered">
                <h1>Base Template Title</h1>
                <p>Text would go here...</p>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-md-auto">
            <?php include "footer.php" ?>
        </div>
    </div>
</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

Utilize CSS Steps to incorporate the initial position

I'm experimenting with CSS steps to create a unique visual effect resembling a "light board". The setup involves a column of 18 divs acting as individual "bulbs", with an animation that positions a div behind each one to simulate a "lit up bulb." The ...

OnePageCheckout may result in empty boxes being displayed due to OneStepCheckout CSS styling

Seeking advice for an issue with the Magento OneStepCheckout module. Upon checkout, there are three columns: customer data (working fine), payment options (selectable via checkbox), and details about the chosen payment method. Unfortunately, the informati ...

Choosing the initial tab to display when the page loads from a selection of 3 tabs

How can I set the "All" tab to be selected by default when the page loads, with the text color black and underlined? .publisher-tab { background-color: rgb(255, 255, 255) !important; color: #B3B3B3; font-family: 'Open Sans'; font-style ...

Pause the event listener temporarily and reattach it after specific actions have been completed

I am currently working on a React app that includes a scrollable div. Here is an example: <main id="main" onScroll={this.handleScroll}> My question is, how can I temporarily remove the onScroll event listener from the main element and then reattach ...

Dropdown feature in the side navigation bar

Is it possible to create a drop-down section in a navigation bar using HTML/CSS/JS? For example, clicking on 'products' would reveal a list of products that disappears when clicked again. If this is achievable, how can it be done? I am currently ...

Navigate through a filtered list of parent items with the use of cursor arrows in AngularJS

My form contains an input with a dropdown, where I display JSON data like this: { "title": "Parent #1", "child" : [ {"title": "Child ##1"}, {"title": "Child ##2"}, {"title": "Child ##3"}, {"title": "Child ##4"} ...

Is it possible to utilize props within a computed property in order to apply a CSS class binding?

Can props be utilized within a computed property in an alternative manner? Upon attempting this, it seems to add the class 'foo' (the props name) instead of the intended 'fa-foo' (or a different value if props were configured). If I d ...

Tips for substituting @media (max-width) with Stylish or Greasemonkey?

I am encountering an issue when trying to access this specific website on my desktop browser. The site has a responsive/fluid design that switches to displaying a mobile menu button instead of a horizontal nav-bar when the browser width is less than 990px. ...

updating the HTML DOM elements using JavaScript is not yielding any response

One way that I am trying to change the background of a div is by using a function. Below is an example of the html code I am working with: $scope.Background = 'img/seg5en.png'; document.getElementById("Bstyle").style.background = "url("+$scope.B ...

Unlocking the AngularJS variable within the template script

My controller code: $scope.totals = totals; In the template, I am able to successfully inject HTML using this code: {{totals}} However, my goal is to access the totals variable in a script within the template. Here's what I attempted: <script& ...

Incorporate the operating hours of a Business

If I specifically choose Sunday and Monday with working hours ranging from 08.00 to 20.00, the output should be 1&08:00&20:00,2&08:00&20:00. How can I achieve this using Vue.js? This is my current code: <script> submitBox = new Vue( ...

Unusual CSS behavior discovered while implementing horizontal scrolling navbar with overflow-x

I've been working on a navbar that will scroll horizontally when it exceeds the width of its parent container. It features a bottom border with a different color for the active link. Using a negative margin to overlap them works well, but as soon as ...

Python Selenium not registering button click

I'm working on scraping data from the website using Python with Selenium and BeautifulSoup. This is the code I have: driver = webdriver.Chrome('my file path') driver.get('https://www.ilcollege2career.com/#/') first_click = Web ...

unable to insert logo into HTML

I am customizing an HTML template, but the dimensions of the logo in the template are smaller than my logo. Despite adding my logo to the template, it is not showing up. @media (max-width: 673px) { #logo { margin-left: 20px; } } #header #logo ...

Pressing the different buttons on a form does not result in the form being submitted

I have a form with multiple buttons that, when submitted, will redirect to a different page and pass along some variables. echo " <form method=\"POST\" action=\"sightWordsTest.php\"> ...

Creating HTML tabs using jQuery with input[type="radio"] tutorial for beginners

I'm having trouble creating a tab with input[type="radio"] using Jquery. The tab works fine on the first click, but it doesn't work on the second click. I can't figure out where the issue is in the Jquery code. Can someone assist m ...

How come Bootstrap Select isn't displaying the selected value when I provide a default option?

Why is it that an object with a set value is only displayed initially if the "--Select--" parameter is omitted? Do you have any insights into this behavior? @Html.DropDownListFor(m => m.FlightDetails.AirlineId, ViewBag.AirlineList as SelectList, "--Se ...

Execute an AJAX post request to the identical PHP page (utilizing the Jquery Form Plugin)

I am in the process of developing a new web interface using JavaTMP, an AJAX-based admin template. After spending time understanding its functionality, I have created a page with a form to allow users to create projects within my software. Typically, creat ...

Interference in the output of .innerHTML leads to disruption

I have been working on a feature to display a calculated price based on the selected quantity for each individual product. I attempted to duplicate the code and modify variable names, but encountered issues with the increase/decrease buttons triggering mul ...

Creating a full-width menu with Material UI - a step-by-step guide

I am currently working on creating a mobile menu that spans the full width of the screen. Despite my efforts, it seems like I might be misunderstanding something as my CSS rules are not being applied correctly. Here is a live code example for reference: ...