Skip to content

Commit 8e21dec

Browse files
committed
added hamburger menu
1 parent 767bb6f commit 8e21dec

File tree

2 files changed

+86
-8
lines changed

2 files changed

+86
-8
lines changed

Portfoliowebsite/port.css

Lines changed: 66 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ ul li a:hover{
7474
padding:77px;
7575
height: 290px;
7676
}
77+
7778
.right_section img{
7879
margin-top: -30px;
7980
width:600px;
@@ -198,6 +199,10 @@ footer{
198199
height: 0.1rem;
199200
}
200201

202+
.menu, .hamburger{
203+
display: none;
204+
}
205+
201206
@media (max-width: 950px){
202207
.con{
203208
flex-direction: column;
@@ -240,6 +245,7 @@ footer{
240245
.components{
241246
font-size: 14px;
242247
}
248+
243249
}
244250

245251
@media (max-width: 650px){
@@ -260,18 +266,71 @@ footer{
260266

261267
.box{
262268
justify-content: space-around;
263-
height: 80px;
269+
height: 50px;
264270
/* margin-top: 0px; */
265271
}
266272

267273

268274
.components{
269-
display: grid;
270-
grid-template-columns: 1fr 1fr;
271-
grid-template-rows: 1fr 1fr 1fr;
272-
margin-top: -27px;
273-
font-size: 13px;
275+
display: none;
274276
}
275277

276-
278+
.menu {
279+
display: block;
280+
}
281+
282+
.hamburger{
283+
display: inline;
284+
}
285+
286+
.hamburger {
287+
position: fixed;
288+
/* a large z-index puts the ham button above the rest of the page*/
289+
z-index: 99;
290+
background: transparent;
291+
border: none;
292+
cursor: pointer;
293+
top: 1rem;
294+
right: 1rem;
295+
}
296+
297+
.menu {
298+
position: fixed;
299+
/* give the menu a larger z-index than the ham link
300+
to put the menu above it */
301+
z-index: 100;
302+
top: 0;
303+
left: 0;
304+
right: 0;
305+
bottom: 0;
306+
width: 100%;
307+
height: 100vh;
308+
/* basic menu styling*/
309+
list-style: none;
310+
background: black;
311+
display: flex;
312+
313+
flex-direction: column;
314+
/* animate slide up/down */
315+
transform: translateY(-100%);
316+
transition: transform 0.2s ease;
317+
}
318+
319+
.close {
320+
position: absolute;
321+
border: none;
322+
color: white;
323+
cursor: pointer;
324+
top: 1rem;
325+
right: 1rem;
326+
}
327+
328+
.menu:target {
329+
/* show menu */
330+
transform: translateY(0);
331+
}
332+
333+
.service{
334+
display: none;
335+
}
277336
}

Portfoliowebsite/port.html

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
<link href="https://fonts.googleapis.com/css2?family=Mukta:wght@700&display=swap" rel="stylesheet">
1414
<link rel="preconnect" href="https://fonts.googleapis.com">
1515
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
16-
<link href="https://fonts.googleapis.com/css2?family=Merriweather:wght@900&display=swap" rel="stylesheet">
16+
<link href="https://fonts.googleapis.com/css2?family=Merriweather:wght@900&display=swap"
17+
rel="stylesheet">
18+
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
1719
</head>
1820

1921
<body>
@@ -32,6 +34,23 @@
3234

3335

3436
</ul>
37+
<ul class="menu" id="menu">
38+
<li><a href="#">Home</a></li>
39+
<li><a href="#">About</a></li>
40+
<li><a href="#">Services</a></li>
41+
<li><a href="#">Projects</a></li>
42+
<li><a href="#">Contact Me</a></li>
43+
<a class="close" href="#">
44+
<span class="material-icons">
45+
close
46+
</span>
47+
</a>
48+
</ul>
49+
<a class="hamburger" href="#menu">
50+
<span class="material-icons">
51+
menu
52+
</span>
53+
</a>
3554
</nav>
3655
</section>
3756

0 commit comments

Comments
 (0)