I tried everything but my footer is stuck in the middle, I even set the body height to 100%/100vh.
footer in the middle (https://phpout.com/wp-content/uploads/2024/01/qzp2i.png)
css:
body {
display: flex;
flex-direction: column;
font-family: "Poppins", sans-serif;
font-family: "Righteous", sans-serif;
font-family: "Roboto", sans-serif;
}
.navbar-nav li a:hover {
color: #536976 !important;
}
.d-flex {
width: 100%;
}
.footer {
width: 100%;
text-align: center;
height: 30px;
margin-top: auto;
position: absolute;
bottom: 0px;
}
.footer p {
margin-top: 25px;
font-size: 12px;
color: #fff;
}
.padding {
padding-top: 20px;
}
.form-hide {
margin: 0px;
padding: 0px;
}
.delete-btn {
margin: 0px;
padding: 0px;
}
.panel-body {
padding: 15px;
text-overflow: ellipsis;
overflow: hidden;
}
.inline {
display: inline;
}
.compose {
margin-top: 50px;
height: calc(100vh - 80px);
}
.post {
margin-top: 50px;
}
.content {
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
overflow: hidden;
}
.journee {
background: #536976;
background: -webkit-linear-gradient(to right, #484e76, #536976);
background: linear-gradient(to left, #484e76, #536976);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
footer:
<footer class="bg-body-tertiary text-center text-lg-start"> <!-- Copyright --> <div class="text-center p-3" style="background-color: #000"> © 2020 Copyright: <a class="text-body" href="https://mdbootstrap.com/">MDBootstrap.com</a> </div> <!-- Copyright --> </footer>
I tried to keep it fixed with position: fixed
.
also the footer is stuck under the posts
i dont know whats happening
i am using bootstrap 5
2
Answers
It looks like you’re using Bootstrap 5 and have some custom styles for your footer. To centre the footer at the bottom of the page, you can make use of the Bootstrap utilities.
Here’s an updated version of your CSS and HTML:
CSS:
HTML:
Key points:
min-height: 100vh
to the body to ensure that it takes at least the full height of the viewport.container
androw
classes to centre the content in the footer.Make sure to adjust the margin, padding, and other styles based on your specific design requirements.
Without the full HTML structure, it’s difficult to understand what is wrong with the code. Please post the HTML as well that will help others to understand the issue easily.