The footer stubbornly insists on residing anywhere but the bottom of the page

In my laravel project, I have structured my layouts into separate navigation, body, and footer components. To bring them all together, I have a layout file set up like this:

app.blade.php: .......

    <style>
          .background-img {
                background-image: url('images/login_background.png');
                background-repeat: no-repeat;
                background-size: 100%;
            }

          .bg-color-navbar {
              background-color:#2d2d2d;
          }
    
    </style>
</head>
<body class="background-img">
     <!-- Navigation bar -->
     @include('layouts.navbar')
    <div id="app" >
        <main class="py-4">
            @yield('content')
        </main>
    </div>
     <!-- Footer -->
    @include('layouts.footer')
</body>
</html>

Here is my footer.blade.php file:

<footer id="footer-content-collapse-sidebar" style="max-width:100%; overflow: hidden; border-top: 1px solid #fbcc34; padding-top: 0.5rem; background-color: #000;">
   ...... (footer content)
</footer>




<style>

a:hover{
     color: grey;
     text-decoration: none;
  }

  span:hover{
     color: grey;
     text-decoration: none;
  }

  .text-font-size{
      font-size: 14px;
  }

@media(min-width:768px){
    .padding-top-md{
        padding-top:100px;
    }
}

@media(max-width:768px){
    .hidden-text{
        display: none;
    }
    .margin-bottom-sm{
        margin-bottom: 0;
    }
}

</style>

Despite my setup, the footer keeps appearing in the middle of the page instead of at the bottom. How can I ensure it stays at the bottom at all times?

Answer №1

In my opinion, the problem could potentially be resolved using CSS. You can try incorporating the following code snippet into your CSS file.

.footer {
  position: fixed;
  left: 0;
  bottom: 0;
  width: 100%;

Answer №2

To begin, you should expand your layout by using the following code:

@extends('layouts.master')

Next, for each section you wish to add in:

@section('title')
//
@endsection

@section('content')
//
@endsection

@section('script')
//
@endsection

It's important to have a starting and closing tag for each section you include.

Answer №3

Implement the following code snippet in your footer CSS for a fixed footer:

.footer {
    position: fixed;
    left: 0;
    bottom: 0;
    width: 100%;
}

If you are looking to create a sticky footer, use the code below:

footer {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 100px;
    width: 100%;
}

}

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

Adjust the dropdown width based on the screen's resolution

I recently encountered an issue while implementing a dropdown menu in my React application. Everything was functioning smoothly until I attempted to change the browser resolution through the console. // index.js: <select id="project_type" ...

Modal box fails to refresh content

Currently, I am in the process of learning how to modify my blog using a modal window. However, when I click on the edit button within the modal, an error message 'Failed to execute 'fetch' on 'Window': Invalid name' appears i ...

When I attempt to access localhost/laravel/public/my_page, the page appears completely blank without displaying any errors

In my Laravel project, all pages function properly when using php artisan serve. However, some pages encounter issues when not using artisan serve. For instance, when I access localhost:8000/my_page, the page loads successfully. But if I try to access lo ...

Retrieving checkbox value upon form submission

Imagine having a form containing several checkboxes. Upon submitting the form, you aim to display all values of the selected checkboxes. <form> <input type="checkbox" id="product1" name="product1" value="12"> <input type="checkbox" id="prod ...

onload function prevents further URL redirection

After submitting the form "View this product," a function is triggered to retrieve the product id from the form data. Although I can successfully obtain the form_data, the page does not redirect as expected. I suspect that my function may not have been pr ...

HTML experiences confusion as JSON tosses undefined data

Can someone assist me with API integration? I am new to this and trying to display the Poster, Title, and Year from an API URL. Here is the code I have been working on. When I log in, it shows JSON in an array but throws "undefined" in front-end. Your help ...

Use a jQuery or XPath selector to choose certain HTML tags from a list of HTML tags

Consider this html structure : ... <div class="a">April 2018</div> <div class="b">Monday 02</div> <div class="c">...</div> <!-- Capture this tag and its children --> <div class="c">...</div> <!-- ...

What could be causing the Bootstrap collapse feature to malfunction?

<nav id="na-vrh" class="navbar navbar-expand-lg navbar navbar-dark bg-dark"> <div class="container-fluid"> <a class="navbar-brand" href="#">Navbar</a> < ...

What is the method to retrieve the local filepath from a file input using Javascript in Internet Explorer 9?

I'm experiencing some issues with the image-preview function on IE9, similar to the example photo shown. This method is not functioning properly and throwing an error in IE9, while it works perfectly fine in IE6-8. I am looking for a way to retrieve ...

Align the content of the list items to the center and position the list in the center of

I am struggling to get the List centered beneath "Contact Me" and the hr tag. Both of those elements are perfectly centered in the column, but the list and icons are aligned to the left. Ideally, I would like them to be in the center like everything else. ...

Using Sass to Loop through Specific Items

Currently, I am in the process of developing a SASS loop to iterate over a series of images (let's say 50). My goal is to increment the transition delay by 50ms for every nth-of-type image. However, it appears that the current for loop I have implemen ...

Tips for positioning a div between two vertically aligned input elements

I'm trying to figure out how to place a div between two inputs with the same height and vertically aligned. It seems like a simple task, but for some reason, the code below isn't working: input{ width: 35%; border: 1px solid #A7A7A7; ...

Unable to properly connect my CSS file to the header partial

I am struggling to include my CSS file in the header partial Here is the link I am using: <link rel="stylesheet" href="stylesheets/app.css"> This is what my directory structure looks like: project models node_modules public stylesh ...

The automatic opening of a modal in a Livewire component is not functioning as expected

I am having trouble displaying a modal when my component initializes. I have tried using $this->emit('show) to open the modal When I add a button in my view, the emit('show') works! However, I want the modal to be automatically shown whe ...

What is the best way to say hello using jQuery?

I need some assistance with a task that involves entering my name into an input field, clicking a button, and having an h1 tag display below the input saying Hello (my name)! Unfortunately, I am struggling to figure out how to achieve this. Below is the H ...

Styling for jQuery mobile panels disappears when used on multiple pages

Currently, I am working on developing a mobile application for PhoneGap using jQuery Mobile. The app consists of multiple pages within the same HTML document. I have configured it so that all pages share the same panel, but I am facing an issue with the st ...

Bootstrap not being recognized in AngularJS HTML

I've been working on learning AngularJS, but unfortunately I can't seem to get any Bootstrap themes to show up in my web application. Here is the HTML code for the header that I've been trying: <nav class="navbar navbar-default"> ...

Exploring the magic of cubic-bezier transitions in combination with Bootstrap Tabs buttons

I'm experimenting with creating a tab button switching animation similar to a specific reference, but without using Bootstrap Tabs. var tabs = $('.tabs'); var selector = $('.tabs').find('a').length; //var selector = ...

Is it possible to have an icon change color in a TableRow column when hovering over any part of that particular row?

I am currently using material-ui version 4.9.5. To illustrate my issue, I have created a simplified example here. I have a Table that is populated with basic JSON data. Each row in the table consists of an icon element along with its corresponding color a ...

Improprove Google PageSpeed score - must resolve

My mobile website is loading incredibly slow, despite my attempts to improve the speed using Google PageSpeed insights. Unfortunately, I'm having trouble interpreting the screenshot and identifying what changes need to be made. Is there anyone who c ...