Comment faire un footer fixe avec Bootstrap ?

Réponses rédigées par Antoine
Dernière mise à jour : 2020-11-30 15:53:27
Thèmes : webmaster - bootstrap
Question

Comment puis-je faire un footer fixe, un pied de page qui reste toujours en bas de l'écran, avec Bootstrap ?

Réponse

Pour concevoir un pied de page fixe (footer), avec le framework HTML Bootstrap, vous devez utiliser la balise <footer>, ainsi que la CLASS CSS fixed-bottom.

<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<title>Comment faire un footer avec Bootstrap 4 ?</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
</head>
<body>
<footer class="py-2 bg-dark fixed-bottom">
<div class="container">
<p class="m-0 text-center text-white">Footer</p>
</div>
</footer>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script>
</body>
</html>

Remarque : la CLASS fixed-bottom fonctionne avec Bootstrap 4 et 5.