Repository navigation
Expand file tree
/
Copy pathindex.html
More file actions
201 lines (164 loc) · 7.88 KB
/
Copy pathindex.html
File metadata and controls
201 lines (164 loc) · 7.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
<!-- This is a comment! Anything enclosed within this will be ignored when the website is rendering :) -->
<!-- I think this webpage is useful so please don't edit out useful information from here... -->
<!--
Comments
can
have
multiple
lines
too
-->
<!--
Structure of a HTML file (specifies all the elements to e.g. display):
! DOCTYPE html>
html>
head>
Specifies other things like stylesheets or title
/head>
body>
Content to be displayed goes here
/body>
/html>
(I removed all the start angle brackets just in case, to make sure the browser doesnt accidentally try rendering it)
Outside of this structure, different people have their different styles :)
Some people will make it organized in <body>, having <header> then <section>s then <footer>
Some may not bother being that organized (or want to give web crawlers a hard time) and have a chaotic mess of <div>s
-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sample Website</title> <!-- Display title -->
<link rel="stylesheet" href="index.css"> <!-- Include index.css as a stylesheet -->
<link rel="icon" type="image/x-icon" href="assets/icon.png"> <!-- Have an icon for the website in the browser -->
</head>
<body>
<!-- Website Header -->
<header>
<h1>Welcome to Sample Website</h1> <!-- <h1> is big heading. <h?> is heading, and the smaller the number (smallest is 1), the larger the heading -->
<nav> <!-- Navigation bar -->
<ul> <!-- ul means unordered list -->
<!-- li means list item -->
<li><a href="#about">About</a></li> <!-- the <a> tag is usually used for text hyperlinks, href is where the hyperlink goes to, # stands for going to an id (so #about means go to the element with id="about") -->
<li><a href="#pages">Peoples' Pages</a></li>
<li><a href="#tools">Tools</a></li>
<li><a href="#form">Request Access</a></li>
<li><a href="https://github.com/Simul-Eqn/StaticWebsiteTutorial" target="_blank">GitHub repository</a></li>
<!-- Hyperlinks can also go to other webpages, which will be redirects -->
</ul>
</nav>
</header>
<!-- About Section -->
<section id="about">
<h2>About This Page</h2>
<p>This website demonstrates various HTML and CSS elements.</p> <!-- <p> means paragraph text -->
</section>
<!-- Peoples' Pages -->
<section id="pages">
<h2>Peoples' Pages!!</h2>
<p>Here you can find everyone's pages</p>
<!-- Cards scroller: everyone's cards are here -->
<div class="card-row-container">
<button class="scroll-btn left" onclick="scrollCards(-1)">◀</button>
<div class="card-row" id="cardRow">
<!-- EACH OF THESE <a> tags is a card! -->
<!-- This is my card! -->
<a href="./pages/simuleqn" class="card">
<img src="./assets/icon.png" alt="Simul-Eqn"> <!-- alt text is what's read by screenreaders (for accessibility e.g. blind people); also used by webscrapers to train AI though -->
<div class="card-text">Simul-Eqn</div>
</a>
<!-- These are placeholder cards! Feel free to edit them!! -->
<a href="./pages/bananasigmamengyao" class="card">
<img src="./assets/banana.png" alt="banana mengyao page">
<div class="card-text">banana mengyao page</div>
</a>
<a href="./pages/anotherpage" class="card">
<img src="./assets/icon.png" alt="Another Page">
<div class="card-text">Another Page</div>
</a>
<a href="./pages/anotherpage" class="card">
<img src="./assets/icon.png" alt="Another Page">
<div class="card-text">Another Page</div>
</a>
<a href="./pages/anotherpage" class="card">
<img src="./assets/icon.png" alt="Another Page">
<div class="card-text">Another Page</div>
</a>
<a href="./pages/anotherpage" class="card">
<img src="./assets/icon.png" alt="Another Page">
<div class="card-text">Another Page</div>
</a>
<!-- Add more cards if you want! -->
</div>
<button class="scroll-btn right" onclick="scrollCards(1)">▶</button>
</div>
<script>
function scrollCards(direction) {
const row = document.getElementById("cardRow");
const scrollAmount = 200;
row.scrollBy({ left: direction * scrollAmount, behavior: 'smooth' });
}
</script>
</section>
<!-- Tools Section -->
<section id="tools">
<h2>Useful Tools</h2>
<ul>
<!-- In <a> tag, setting target="_blank" makes the link open it in a new tab instead (or sometimes new window depending on browser config) -->
<li><a href="https://github.com/" target="_blank">GitHub</a></li>
<li><a href="https:/dash.cloudflare.com/" target="_blank">Cloudflare Dashboard</a></li>
<li><a href="https://developer.mozilla.org/" target="_blank">MDN Web Docs</a></li>
<li><a href="https://css-tricks.com/" target="_blank">CSS-Tricks</a></li>
<li><a href="https://codepen.io/" target="_blank">CodePen</a></li>
</ul>
<!-- Example of an image -->
<img src="./assets/icon.png" alt="Example image" /> <!-- NOTE that the <img> tag doesn't have a </img>, it just directly ends with /> (instead of > ) !! Though browsers usually auto-correct it if they see this mistake but it's good to take note of this -->
</section>
<!-- Request Access Form Section -->
<!-- NOTE: This does not work if you request access on your live server preview because granting access requires a secret token I'm not giving you all HAHA -->
<section id="form">
<h2>Give me access!!</h2>
<form>
<label for="name">GitHub Username:</label>
<input type="text" id="name" name="GitHub Username" required>
<label for="message">(optional) Extra Message:</label>
<textarea id="message" name="message" rows="4"></textarea>
<button type="submit">Request Access</button> <!-- This submit button will -->
</form>
</section>
<!-- JavaScript script to handle the form -->
<!-- This script can be placed anywhere on the website -->
<script>
document.querySelector("form").addEventListener("submit", async function (event) {
event.preventDefault();
const name = document.getElementById("name").value;
const message = document.getElementById("message").value;
try {
const response = await fetch("https://staticwebsitegrantaccess.qubitmechanics.workers.dev/api/submit", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
name,
message
})
});
if (!response.ok) {
throw new Error(`Error: ${response.status}`);
}
const result = await response.json();
alert("Access request successful! You should receive an email invite soon.");
} catch (error) {
console.error(error);
alert("Failed to request access.");
}
});
</script>
<!-- Website Footer -->
<footer>
<p>No rights reserved.</p>
</footer>
</body>
</html>