-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from jeffjadulco/next
Migrate from Gatsby to Next.js + Other stuff
- Loading branch information
Showing
100 changed files
with
16,784 additions
and
24,627 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
{ | ||
"arrowParens": "avoid", | ||
"semi": false | ||
"semi": false, | ||
"singleQuote": true | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
--- | ||
title: 'CSS Snippet: Stay at the bottom, footer!' | ||
publishedAt: '2021-01-31' | ||
isPublished: true | ||
tags: ['css'] | ||
description: CSS trick to keep the footer at the bottom | ||
toc: false | ||
seoImage: '/static/og/blog/bottom-footer.png' | ||
--- | ||
|
||
 | ||
|
||
I experienced this footer problem before in this site, but I got away with it because there are no pages that have no content to make this happen 😆. But in this [side project](https://hn.jeffjadulco.com) of mine (which is a Hacker News reader), there are times when a post don't have no comments yet, and I have no control over it. | ||
|
||
I've looked for solutions over the internet and this is the most clever solution I saw: using `flexbox`. | ||
|
||
```jsx | ||
<html> | ||
<body> | ||
<header>Header</header> | ||
<main>Content</main> | ||
<footer>Footer</footer> | ||
</body> | ||
</html> | ||
``` | ||
|
||
```css | ||
body { | ||
display: flex; | ||
flex-direction: column; | ||
min-height: 100vh; | ||
} | ||
|
||
main { | ||
flex-grow: 1; | ||
} | ||
``` | ||
|
||
I love this solution because it's so simple and it tells us what it does. | ||
|
||
> 💡 The whole body is a flexbox which has a minimum height of whatever the browser's height is. | ||
> | ||
> 💡 The main content's height grows to occupy the remaining space. Pushing the footer to the bottom of the page. | ||
 | ||
|
||
And... that's it! Now the footer stays at the bottom whenever there are no or few contents in the page. | ||
|
||
You can easily do it on Tailwind too! | ||
|
||
```html | ||
<div class="min-h-screen flex flex-col"> | ||
<header>Header</header> | ||
<main class="flex-grow">Main Content</main> | ||
<footer>Footer</footer> | ||
</div> | ||
``` | ||
|
||
I've also made a simple example using CodeSandbox and Tailwind Play. | ||
|
||
- [CodeSandbox sample](https://codesandbox.io/s/hopeful-lichterman-g8dkb?file=/index.html) | ||
- [Tailwind Play sample](https://play.tailwindcss.com/pymHJ6XIPU) |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.