I fixed it! I had h-screen instead of min-h-screen in the home component
When I use footer component in react , footer does not set at the bottom of the page. It fits in the middle
function App() {
return (
<>
`<Navbar />
<Routes>
<Route path="/" element={ <Home /> } />
<Route path="about" element={ <About /> } />
<Route path="collection" element={ <Collection /> }/>
<Route path="contact" element={ <Contact /> } />
<Route path='*' element={ <Error /> } />
</Routes>
<Footer />
</>
)
}
footer
import React from 'react'
const Footer = () => {
return (
<div>
<h1>Footer</h1>
</div>
)
}
I tried almost everything but…
2
Answers
you can wrap your components in a
div
and style the div usingflex-box
css
this will push down the footer to the bottom even when there is no content on the screen/routes optionally you can push the footer down even more by using the
margin
propertyif you are trying to make the footer always at the bottom ie make it fixed to the bottom overlaying any content u can use the styles below on the footer and omit the code I wrote above
There’s no more code to fix but you could be just looking for it be fixed at bottom by positioning?