I want to fix this div at the bottom of my webpage, here is my react code:
It’s written in tailwind css but you can answer in normal css too
I’ve tried using bottom property but it didn’t work
<div className="flex flex-wrap justify-center p-4 bottom-8"/>
2
Answers
To fix a
<div>
at the bottom of the page, we can use Tailwind’s positioning utilities correctly. The bottom-8 class alone won’t work unless it is set the element’s position. we can resolve it using following coderefer the offical documentation https://tailwindcss.com/docs/position to learn more about
Position Utilities
I’ll offer a normal CSS answer: If you want the div to "stick" to the bottom of the page (so that it’s always visible as you scroll), use
If you want the div to be at the actual bottom of the page, there’s many ways to do it. My thought process:
height
andwidth
to occupy the whole web page.display
attribute of the parent, you can give an attribute to the footer that will push it to the bottom of the parent div. (For example, if the parent hasdisplay: flex
, then you can give the parentjustify-content: space-between
andflex-direction: column
; this will arrange the children in a column, and space them out evenly, sending the last child to the bottom of the page.)