Skip to content

Commit fa27d17

Browse files
committed
Refactor Navbar CSS for improved mobile responsiveness and styling
1 parent b08bc36 commit fa27d17

File tree

1 file changed

+88
-173
lines changed

1 file changed

+88
-173
lines changed

‎src/Navbar.css‎

Lines changed: 88 additions & 173 deletions
Original file line numberDiff line numberDiff line change
@@ -1,188 +1,103 @@
11
.navbar {
2-
2+
background-color: #1e3a8a;
3+
color: white;
4+
padding: 15px 20px;
5+
display: flex;
6+
justify-content: center;
7+
width: 100%;
8+
position: sticky;
9+
top: 0;
10+
z-index: 50;
11+
box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
12+
}
13+
14+
.nav-container {
15+
display: flex;
16+
justify-content: space-between;
17+
align-items: center;
18+
width: 100%;
19+
max-width: 1200px;
20+
padding: 0 20px;
21+
}
22+
23+
.logo {
24+
font-size: 24px;
25+
font-weight: bold;
26+
text-decoration: none;
27+
color: white;
28+
}
29+
30+
.nav-links {
31+
display: flex;
32+
gap: 25px;
33+
}
34+
35+
.nav-links a {
36+
color: white;
37+
text-decoration: none;
38+
font-size: 18px;
39+
transition: color 0.3s ease;
40+
}
41+
42+
.nav-links a:hover {
43+
color: #facc15;
44+
}
45+
46+
.menu-button {
47+
background: none;
48+
border: none;
49+
cursor: pointer;
50+
display: none;
51+
color: white;
52+
font-size: 28px;
53+
}
54+
55+
@media (max-width: 768px) {
56+
.navbar {
57+
height: 10vh;
58+
}
59+
.nav-links {
60+
position: absolute;
61+
top: 60px;
62+
left: 0;
63+
width: 100%;
364
background-color: #1e3a8a;
4-
5-
color: white;
6-
7-
padding: 15px 20px;
8-
9-
display: flex;
10-
11-
justify-content: space-between;
12-
65+
flex-direction: column;
1366
align-items: center;
14-
15-
width: 100%;
16-
17-
position: sticky;
18-
19-
top: 0;
20-
21-
z-index: 50;
22-
23-
box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
24-
25-
}
26-
27-
28-
29-
30-
.nav-container {
31-
67+
gap: 0;
68+
padding: 10px 0;
3269
display: flex;
33-
34-
justify-content: space-between;
35-
36-
align-items: center;
37-
38-
width: 100%;
39-
40-
max-width: 1200px;
41-
42-
margin: auto;
43-
70+
transform: translateY(-100%);
71+
opacity: 0;
72+
visibility: hidden;
73+
transition: transform 0.4s ease-out, opacity 0.2s ease-in, visibility 0.2s ease-in;
4474
}
4575

46-
47-
48-
49-
.logo {
50-
51-
font-size: 24px;
52-
53-
font-weight: bold;
54-
55-
text-decoration: none;
56-
57-
color: white;
58-
59-
}
60-
61-
62-
63-
64-
.nav-links {
65-
66-
display: flex;
67-
68-
gap: 25px; /* Adjust spacing between links */
69-
76+
.nav-links.open {
77+
transform: translateY(0);
78+
opacity: 1;
79+
visibility: visible;
80+
transition: transform 0.4s ease-out, opacity 0.3s ease-out, visibility 0.3s ease-out;
7081
}
7182

72-
73-
74-
7583
.nav-links a {
76-
77-
color: white;
78-
79-
text-decoration: none;
80-
81-
font-size: 18px;
82-
83-
transition: color 0.3s;
84-
85-
}
86-
87-
88-
89-
90-
.nav-links a:hover {
91-
92-
color: #facc15;
93-
84+
display: block;
85+
padding: 10px;
86+
width: 100%;
87+
text-align: center;
9488
}
9589

96-
97-
98-
99-
/* Mobile Menu */
100-
10190
.menu-button {
102-
103-
background: none;
104-
105-
border: none;
106-
107-
cursor: pointer;
108-
109-
display: none;
110-
111-
color: white;
112-
113-
font-size: 24px;
114-
91+
display: block;
92+
padding: 0.8rem 0rem;
11593
}
94+
}
11695

117-
118-
119-
120-
.mobile-menu {
121-
122-
display: none;
123-
96+
@media (max-width : 480px) {
97+
.nav-container{
98+
padding: 0 10px;
12499
}
125-
126-
127-
128-
129-
@media (max-width: 768px) {
130-
131-
.nav-links {
132-
133-
display: none;
134-
135-
}
136-
137-
138-
139-
140-
.menu-button {
141-
142-
display: block;
143-
144-
}
145-
146-
147-
148-
149-
.mobile-menu {
150-
151-
display: block;
152-
153-
background-color: #1e3a8a;
154-
155-
padding: 10px;
156-
157-
text-align: center;
158-
159-
}
160-
161-
162-
163-
164-
.mobile-menu a {
165-
166-
display: block;
167-
168-
color: white;
169-
170-
padding: 10px 0;
171-
172-
text-decoration: none;
173-
174-
}
175-
176-
177-
178-
179-
.mobile-menu a:hover {
180-
181-
color: #facc15;
182-
183-
184-
}
185-
186-
}
187-
/* Update */
188-
100+
.navbar {
101+
padding: 10px 5px;
102+
}
103+
}

0 commit comments

Comments
 (0)