Skip to content

Commit 0b3443e

Browse files
authored
Update index.html
Added better mobile support
1 parent e9882b0 commit 0b3443e

File tree

1 file changed

+25
-4
lines changed

1 file changed

+25
-4
lines changed

index.html

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
.menu-container a {
3232
text-decoration: none;
33-
color: #ffffff; /* Changed for visibility */
33+
color: #ffffff;
3434
transition: color 0.3s ease;
3535
}
3636

@@ -51,7 +51,7 @@
5151
}
5252

5353
/* Mobile Styles */
54-
@media only screen and (max-width: 767px) {
54+
@media only screen and (max-width: 767px) {
5555
.menu-container {
5656
flex-direction: column;
5757
align-items: flex-start;
@@ -62,8 +62,8 @@
6262
}
6363

6464
.menu {
65+
display: none;
6566
width: 100%;
66-
display: flex;
6767
flex-direction: column;
6868
}
6969

@@ -76,15 +76,26 @@
7676
padding: 10px 0;
7777
text-align: center;
7878
}
79+
80+
/* Menu button */
81+
.hamburger {
82+
display: block;
83+
font-size: 30px;
84+
cursor: pointer;
85+
}
7986
}
8087

8188
/* Desktop Styles */
82-
@media only screen and (min-width: 768px) {
89+
@media only screen and (min-width: 768px) {
8390
.menu {
8491
display: flex;
8592
justify-content: space-between;
8693
width: 100%;
8794
}
95+
96+
.hamburger {
97+
display: none;
98+
}
8899
}
89100
</style>
90101
</head>
@@ -95,6 +106,9 @@
95106
<img src="https://i.postimg.cc/6qgPbyGH/temp-Image-BJ164c.avif" alt="Coding Hut Logo"/>
96107
</a>
97108

109+
<!-- Menu for Mobile -->
110+
<span class="hamburger" onclick="toggleMenu()">&#9776;</span>
111+
98112
<!-- Menu Items -->
99113
<div class="menu">
100114
<ul>
@@ -112,5 +126,12 @@
112126
<h1 style="text-align:center;"><b>Coding Hut</b></h1>
113127
<h2 style="text-align:center;">Welcome to the official Coding Hut website.</h2>
114128
<p style="text-align:center;">Remember that Coding Hut was founded by @MyScratchedAccount on Dec. 27, 2022</p>
129+
130+
<script>
131+
function toggleMenu() {
132+
var menu = document.querySelector('.menu');
133+
menu.style.display = menu.style.display === 'flex' ? 'none' : 'flex';
134+
}
135+
</script>
115136
</body>
116137
</html>

0 commit comments

Comments
 (0)