Skip to content

Commit ce5e990

Browse files
committed
Add HTML
1 parent 8060a1f commit ce5e990

File tree

3 files changed

+130
-0
lines changed

3 files changed

+130
-0
lines changed

public/data/_index.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
"lang": "CSS",
88
"icon": "/icons/css.svg"
99
},
10+
{
11+
"lang": "HTML",
12+
"icon": "/icons/html5.svg"
13+
},
1014
{
1115
"lang": "Python",
1216
"icon": "/icons/python.svg"

public/data/html.json

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

public/icons/html5.svg

Lines changed: 8 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)