Sticky footer when using the side nav
See original GitHub issueI am trying to add the material2 side nav to my home page that has a header, content and a sticky footer using flex, but I am having no luck. (example of sticky footer I’m using https://philipwalton.github.io/solved-by-flexbox/demos/sticky-footer/)
Has anyone managed to do this and could point me in the right direction?
my current html
<div class="site">
<md-sidenav-layout class="site">
<header class="site-header">
<md-sidenav #sidenav mode="over" class="app-sidenav" opened>
<md-toolbar color="primary">
<h2>Menu</h2>
</md-toolbar>
<md-nav-list>
<a *ngFor="let navItem of navItems"
md-list-item
[routerLink]="[navItem.route]">
<md-icon>{{navItem.icon}}</md-icon>
{{navItem.name}}
</a>
</md-nav-list>
</md-sidenav>
<md-toolbar color="primary">
<button md-icon-button (click)="sidenav.toggle()">
<md-icon class="md-24" >menu</md-icon>
</button>
</md-toolbar>
</header>
<div class="app-content site-content site-content--full">
<router-outlet></router-outlet>
</div>
<footer class="site-footer">...</footer>
</md-sidenav-layout>
</div>
my css:
.site {
display: flex;
flex-direction: column;
height: 100%; /* 1, 3 */
}
.site-header,
.site-footer {
flex: none; /* 2 */
}
.site-content {
flex: 1 0 auto; /* 2 */
padding: var(--space) var(--space) 0;
width: 100%;
}
.site-content::after {
content: '\00a0'; /* */
display: block;
margin-top: var(--space);
height: 0px;
visibility: hidden;
}
@media (--break-lg) {
.site-content {
padding-top: var(--space-lg);
}
.site-content::after {
margin-top: var(--space-lg);
}
}
.site-content--full {
padding: 0;
}
.site-content--full::after {
content: none;
}
html,
body {
height: 100%;
margin: 0;
}
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
How to keep footer from pushing up sticky sidebar
Move your footer from outside the section area into it and your navbar will keep being sticky to the bottom of the page....
Read more >Scrollable sidebar with sticky footer using Flexbox - YouTube
Receive a monthly CSS nugget by email: https://codyhouse.co/newsletter CSS trick! Learn how to use Flexbox to create a scrollable sidebar ......
Read more >Sidebar Issue and Sticky Footer - HTML & CSS - SitePoint
The trick is to contain your header ( which changes height from page to page), and your content in ONE wrapper, and make...
Read more >[Question] Sticky footer in sidebar nav #2593 - GitHub
I am using the below currently but because of position: absolute it is overlapping the nav items when they are expanded. Note that...
Read more >Bootstrap 5 sidebar example 2 (sticky footer)) on Codeply
Sticky position is used to make the sidebar appear fixed. A multi-level sidebar with collapsible menu items. The sidebar moves to horizontal top...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Codebacca @EladBezalel this works. You have to make sure you dont have the wrapper around the “side nav” menu elements
HTML:
CSS:
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.