I use Laravel Inertia Vue on my project and use bootstrap 5.2.2 in my depedencies.
After load the css to tag, i want to make sticky footer. But i wonder why the footer is not sticky on the bottom.
I already try to find solution, and its still dont work after i apply the solution to my code.
My blade code:
<!DOCTYPE html>
<html >
<head>
<meta charset="utf-8" />
<meta name="description" content="Website name" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
<link href="{{ mix('/css/app.css') }}" rel="stylesheet"/>
<link href="{{ asset('/css/offcanvas.css') }}" rel="stylesheet"/>
<script src="{{ mix('/js/app.js') }}" defer></script>
</head>
<body >
@inertia
</body>
</html>
My components layout page:
<template>
<header>
<nav aria-label="Main navigation">
//Nav here
</nav>
</header>
<div >
<nav aria-label="Secondary navigation">
<span >Silakan pilih menu:</span>
<Link v-for="(menu, index) in menus" :key="index" :href="`/page/${menu.id}`">{{
menu.name
}} </Link>
</nav>
</div>
<main >
<div >
<slot />
</div>
</main>
<footer >
<div >
<span >Place sticky footer content here.</span>
</div>
</footer>
</template>
CodePudding user response:
From the example where you got the code for the sticky footer, there is an external css
file where the footer gets it's stickyness from. I have copied it and I will paste here(Inline CSS)
Change your blade code to this:
<!DOCTYPE html>
<html >
<head>
<meta charset="utf-8" />
<meta name="description" content="Website name" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
<link href="{{ mix('/css/app.css') }}" rel="stylesheet"/>
<link href="{{ asset('/css/offcanvas.css') }}" rel="stylesheet"/>
<script src="{{ mix('/js/app.js') }}" defer></script>
<style>
/* Sticky footer styles
-------------------------------------------------- */
html {
position: relative;
min-height: 100%;
}
body {
margin-bottom: 60px; /* Margin bottom by footer height */
}
.footer {
position: absolute;
bottom: 0;
width: 100%;
height: 60px; /* Set the fixed height of the footer here */
line-height: 60px; /* Vertically center the text there */
background-color: #f5f5f5;
}
</style>
</head>
<body >
@inertia
</body>
</html>