Materalize footer doesn't stay at bottom?

Im using materialize for my webpage, and for some reason the footer won't stay at the bottom even though I use Materialize own recommended CSS for this. Am I missing something?

Here's the CSS:

body {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
}

main {
  flex: 1 0 auto;
}

And here's the HTML for the footer:

<footer class="page-footer green lighten-1">
<div class="container">
    <div class="wrapper">

      <!--   Icon Section   -->
      <div class="row">
        <div class="col s12 m4">
          <div class="icon-block">
            <h4 class="green-text" id="mailIcon"><i class="material-icons">mail</i></h4>
            <p class="white-text">[email protected]</p>
          </div>
      </div>

        <div class="col s12 m4">
          <div class="icon-block">
            <h4 class="green-text" id="adressIcon"><i class="material-icons">map</i></h4>
            <p>Veldrom AB, Anckargripsgatan 3, 211 19 Malmö, Sweden</p>
          </div>
        </div>

        <div class="col s12 m4">
          <div class="icon-block">
            <h4 class="green-text" id="phoneIcon"><i class="material-icons">phone</i></h4>
            <p class="white-text">+46 720 427 346</p>
          </div>
        </div>
      </div>
</footer>

Upvotes: 0

Views: 909

Answers (2)

PROBLEM SOLVED.

Didn't use a main tag.

<body>

  <main>  //added 
     <div class="container">
     </div>
  </main>

  <footer> this is my footer </footer>
<body>

Upvotes: 1

Azeem
Azeem

Reputation: 145

For sticking your footer to the botton add this to your css:

.page-footer{
    position: fixed;
   left: 0;
   bottom: 0;
   width: 100%;
   background-color: red;
   color: white;
   text-align: center;
}

The Complete CSS will be:

body {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
}

main {
  flex: 1 0 auto;
}


.page-footer{
    position: fixed;
   left: 0;
   bottom: 0;
   width: 100%;
   background-color: red;
   color: white;
   text-align: center;
}

Reference

Upvotes: 0

Related Questions