|
| 1 | +[ |
| 2 | + { |
| 3 | + "language": "html", |
| 4 | + "categoryName": "Basic Layouts", |
| 5 | + "snippets": [ |
| 6 | + { |
| 7 | + "title": "Sticky Header-Footer Layout", |
| 8 | + "description": "Full-height layout with sticky header and footer, using modern viewport units and flexbox.", |
| 9 | + "code": [ |
| 10 | + "<!DOCTYPE html>", |
| 11 | + "<html style=\"margin: 0\">", |
| 12 | + " <head>", |
| 13 | + " <style type=\"text/css\">", |
| 14 | + " body {", |
| 15 | + " margin: 0;", |
| 16 | + " display: flex;", |
| 17 | + " flex-direction: column;", |
| 18 | + " min-height: 100svh; /* Smallest viewport height */", |
| 19 | + " min-height: 100vh; /* Standard viewport height */", |
| 20 | + " min-height: 100dvh; /* Dynamic viewport height */", |
| 21 | + " min-height: 100lvh; /* Largest viewport height */", |
| 22 | + " background-color: red;", |
| 23 | + " }", |
| 24 | + "", |
| 25 | + " .header {", |
| 26 | + " position: sticky;", |
| 27 | + " top: 0;", |
| 28 | + " left: 0;", |
| 29 | + " right: 0;", |
| 30 | + " background-color: blue;", |
| 31 | + " }", |
| 32 | + "", |
| 33 | + " .body {", |
| 34 | + " flex-grow: 1;", |
| 35 | + " background-color: whitesmoke;", |
| 36 | + " }", |
| 37 | + "", |
| 38 | + " .footer {", |
| 39 | + " position: sticky;", |
| 40 | + " bottom: 0;", |
| 41 | + " left: 0;", |
| 42 | + " right: 0;", |
| 43 | + " background-color: blue;", |
| 44 | + " }", |
| 45 | + " </style>", |
| 46 | + " <head>", |
| 47 | + " <body>", |
| 48 | + " <div class=\"header\">header</div>", |
| 49 | + " <div class=\"body\">body/content</div>", |
| 50 | + " <div class=\"footer\">footer</div>", |
| 51 | + " </body>", |
| 52 | + "</html>" |
| 53 | + ], |
| 54 | + "tags": ["html", "css", "layout", "sticky", "flexbox", "viewport"], |
| 55 | + "author": "GreenMan36" |
| 56 | + }, |
| 57 | + { |
| 58 | + "title": "Grid Layout with Navigation", |
| 59 | + "description": "Full-height grid layout with header navigation using nesting syntax.", |
| 60 | + "code": [ |
| 61 | + "<!DOCTYPE html>", |
| 62 | + "<html>", |
| 63 | + " <head>", |
| 64 | + " <style>", |
| 65 | + " body {", |
| 66 | + " margin: 0;", |
| 67 | + " min-height: 100vh;", |
| 68 | + " display: grid;", |
| 69 | + " grid-template-rows: auto 1fr auto;", |
| 70 | + " background: red; /* Shouldn't be visible */", |
| 71 | + " }", |
| 72 | + "", |
| 73 | + " .header {", |
| 74 | + " background: #3b82f6;", |
| 75 | + " padding: 1rem;", |
| 76 | + " display: flex;", |
| 77 | + " & .menu {", |
| 78 | + " margin-left: auto;", |
| 79 | + " }", |
| 80 | + " & .menu ul {", |
| 81 | + " margin-left: auto;", |
| 82 | + " display: flex;", |
| 83 | + " gap: 1rem;", |
| 84 | + " }", |
| 85 | + " }", |
| 86 | + "", |
| 87 | + " .main {", |
| 88 | + " background: #f3f4f6;", |
| 89 | + " padding: 1rem;", |
| 90 | + " }", |
| 91 | + "", |
| 92 | + " .footer {", |
| 93 | + " background: #1f2937;", |
| 94 | + " padding: 1rem;", |
| 95 | + " }", |
| 96 | + " </style>", |
| 97 | + " </head>", |
| 98 | + " <body>", |
| 99 | + " <div class=\"header\">", |
| 100 | + " Header", |
| 101 | + " <nav class=\"menu\">", |
| 102 | + " <ul>", |
| 103 | + " <li><a href=\"#\">Home</a></li>", |
| 104 | + " <li><a href=\"#\">About</a></li>", |
| 105 | + " <li><a href=\"#\">Contact</a></li>", |
| 106 | + " </ul>", |
| 107 | + " </nav>", |
| 108 | + " </div>", |
| 109 | + " <div class=\"main\">Main Content</div>", |
| 110 | + " <div class=\"footer\">Footer</div>", |
| 111 | + " </body>", |
| 112 | + "</html>" |
| 113 | + ], |
| 114 | + "tags": ["html", "css", "layout", "sticky", "grid", "full-height"], |
| 115 | + "author": "GreenMan36" |
| 116 | + } |
| 117 | + ] |
| 118 | + } |
| 119 | +] |
0 commit comments