forked from CodeYourFuture/HTML-CSS-Challenges
-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathindex.html
More file actions
59 lines (55 loc) · 1.66 KB
/
index.html
File metadata and controls
59 lines (55 loc) · 1.66 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Flexbox and Position Example</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<!-- Navbar -->
<nav class="navbar">
<div class="logo">MySite</div>
<ul class="nav-items">
<li><a href="#">Home</a></li>
<li><a href="#">Services</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
</ul>
</nav>
<!-- Hero / Banner -->
<section class="hero">
<h1>Welcome to My Page</h1>
<p>Learn Flexbox and Position with this example.</p>
</section>
<!-- Flexbox items container -->
<section class="items-container">
<div class="item"><p>Item 1</p></div>
<div class="item"><p>Item 2</p></div>
<div class="item">
<p>Item 3</p>
<div id="special-badge">Special Item</div>
</div>
<div class="item"><p>Item 4</p></div>
<div class="item"><p>Item 5</p></div>
<div class="item"><p>Item 6</p></div>
</section>
<button id="backToTop">⬆ Back to Top</button>
<!-- Footer -->
<footer class="footer">
<p>© 2025 MySite. All rights reserved.</p>
<div class="footer-links">
<a href="#">Privacy</a>
<a href="#">Terms</a>
<a href="#">Help</a>
</div>
</footer>
<script>
// Back to Top button functionality
const btn = document.getElementById("backToTop");
btn.addEventListener("click", () => {
window.scrollTo({ top: 0, behavior: "smooth" });
});
</script>
</body>
</html>