Last active
December 24, 2024 13:27
-
-
Save michaelcpuckett/93dd304da7d1ac1329bb1e8441f13031 to your computer and use it in GitHub Desktop.
layout with header and footer
This file contains hidden or 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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8" /> | |
| <meta | |
| name="viewport" | |
| content="width=device-width, initial-scale=1, viewport-fit=cover" | |
| /> | |
| <style> | |
| :where(*) { | |
| box-sizing: border-box; | |
| } | |
| html { | |
| display: grid; | |
| height: 100%; | |
| overflow: hidden; | |
| overscroll-behavior: none; | |
| container-name: root; | |
| container-type: inline-size; | |
| } | |
| body { | |
| margin: 0; | |
| overflow: hidden; | |
| overscroll-behavior: none; | |
| display: grid; | |
| grid-template-rows: auto minmax(0px, 1fr) auto; | |
| } | |
| :where(p) { | |
| margin-top: 0; | |
| margin-bottom: 0; | |
| } | |
| .top, | |
| .bottom { | |
| background: #ddd; | |
| } | |
| .top, | |
| p, | |
| .bottom { | |
| padding: 1rem; | |
| padding-left: calc(1rem + env(safe-area-inset-left)); | |
| padding-right: calc(1rem + env(safe-area-inset-right)); | |
| } | |
| .top { | |
| padding-top: 1rem; | |
| padding-top: calc(1rem + env(safe-area-inset-top)); | |
| } | |
| .bottom { | |
| padding-bottom: 1rem; | |
| padding-bottom: calc(1rem + env(safe-area-inset-bottom)); | |
| } | |
| p { | |
| height: 100cqh; | |
| background: red; | |
| } | |
| p:last-of-type { | |
| background: blue; | |
| } | |
| .top { | |
| touch-action: none; | |
| } | |
| .middle { | |
| display: grid; | |
| height: 100%; | |
| overflow-y: auto; | |
| container-name: main; | |
| container-type: size; | |
| } | |
| .bottom { | |
| touch-action: none; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <div class="top">Header</div> | |
| <div class="middle"> | |
| <p>Main</p> | |
| <p>123</p> | |
| </div> | |
| <div class="bottom">Footer</div> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment