On my website, I am struggling to get the footer always at the bottom of the page but I mean at the bottom of the page below the content. It seems that in my case the footer stays always position at the height of the screen instead of being below the content and adjust its position.
This what it looks like:
below is the code of the App.js who handle the layout
-ing
import React from 'react';
import { BrowserRouter as Router, Route, Switch } from 'react-router-dom';
import Header from './components/Header';
import Footer from './components/Footer';
import Home from './pages/Home';
import NoPages from './pages/NoPages';
import Discover from './pages/Discover';
import HowItWorks from './pages/HowItWork';
import CreateClassAndHost from './pages/CreateClassAndHost';
import Profile from './pages/Profile';
import Messages from './pages/Messages';
import Settings from './pages/Settings';
import Logout from './pages/Logout';
import CreateClass from './pages/CreateClass';
import CreateHost from './pages/CreateHost';
import HereIsTheMission from './pages/HereIsTheMission';
import SuccessfullSubmission from './pages/SuccessfullSubmission';
import CreateHostOnBoardingForm from './pages/HostCreationOnBoarding/CreateHostOnBoardingForm';
import CreateClassOnBoardingForm from './pages/ClassCreationOnBoarding/CreateClassOnBoardingForm';
import './App.css';
function App() {
return (
<div className="app-container">
<div class="app-header">
<div class="app-header-menu">
<Header />
</div>
</div>
<Router>
<div className="page-content">
<Switch>
<Route path="/" exact component={ Home } />
<Route path="/discover" component={ Discover } />
<Route path="/howitworks" component={ HowItWorks } />
<Route path="/create" component={ CreateClassAndHost } />
<Route path="/profile" component={ Profile } />
<Route path="/messages" component={ Messages } />
<Route path="/settings" component={ Settings } />
<Route path="/logout" component={ Logout } />
<Route path="/hereisthemission" component={ HereIsTheMission } />
<Route path="/createaclass" component={ CreateClass } />
<Route path="/createahost" component={ CreateHost } />
<Route path="/successfull" component={ SuccessfullSubmission } />
<Route path="/onboardingclasscreation" component= { CreateClassOnBoardingForm} />
<Route path="/onboardinghostcreation" component= { CreateHostOnBoardingForm } />
<Route path="*" component={ NoPages } />
</Switch>
</div>
</Router>
<div class="app-footer">
<div class="app-footer-menu">
<Footer/>
</div>
</div>
</div>
);
}
export default App;
and the associated css:
body,html{
height :100%;
}
.app-container{
display :flex;
flex-direction:column;
justify-content:space-between;
height:100%;
}
.app-header{
background-color:white;
padding:10px;
}
.app-header-menu{
background-color:white;
padding:10px;
width:100vw;
}
.app-footer{
position:absolute;
text-align:center;
flex-shrink: 0;
bottom: 0;
}
.app-footer-menu{
padding:10px;
background-color:white;
width:100vw;
}
.page-content {
min-height: 100vh;
flex: 1 0 auto;
}
Any idea to always make sure the footer is at the bottom below the content. Thanks