Skip to content

Commit db29b6c

Browse files
committed
navbar responsif
1 parent 7adcc52 commit db29b6c

File tree

1 file changed

+125
-13
lines changed

1 file changed

+125
-13
lines changed

styles.css

Lines changed: 125 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@ body {
44
margin: 0;
55
padding: 0;
66
box-sizing: border-box;
7-
background-color: #f9f9f9;
8-
color: #333;
7+
background-color: #111;
8+
color: #fff;
99
line-height: 1.6;
10+
scroll-behavior: smooth;
1011
}
1112

1213
header {
1314
text-align: center;
1415
padding: 2rem 1rem;
15-
background: linear-gradient(135deg, #4e54c8, #8f94fb);
16+
background: linear-gradient(135deg, #000, #333);
1617
color: white;
1718
}
1819

@@ -25,30 +26,99 @@ p {
2526
font-size: 1.1rem;
2627
}
2728

29+
/* Navbar */
30+
nav {
31+
position: sticky;
32+
top: 0;
33+
z-index: 1000;
34+
background-color: #000;
35+
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
36+
}
37+
2838
nav ul {
2939
display: flex;
3040
justify-content: center;
41+
align-items: center;
3142
padding: 0;
43+
margin: 0;
3244
list-style: none;
33-
background-color: #4e54c8;
3445
}
3546

3647
nav ul li {
37-
margin: 0 15px;
48+
margin: 0 20px;
3849
}
3950

4051
nav ul li a {
4152
text-decoration: none;
4253
color: white;
4354
padding: 10px 15px;
44-
transition: 0.3s;
55+
border-radius: 8px;
56+
transition: background-color 0.3s ease, transform 0.3s ease;
4557
}
4658

4759
nav ul li a:hover {
48-
background-color: #8f94fb;
49-
border-radius: 8px;
60+
background-color: #444;
61+
transform: scale(1.1);
62+
}
63+
64+
/* Hamburger Menu (Untuk Layar Kecil) */
65+
.menu-toggle {
66+
display: none;
67+
flex-direction: column;
68+
cursor: pointer;
69+
padding: 10px;
70+
}
71+
72+
.menu-toggle span {
73+
background: white;
74+
height: 3px;
75+
width: 30px;
76+
margin: 5px 0;
77+
transition: 0.4s;
78+
}
79+
80+
@media (max-width: 768px) {
81+
nav ul {
82+
flex-direction: column;
83+
align-items: center;
84+
display: none;
85+
}
86+
87+
nav ul.active {
88+
display: flex;
89+
}
90+
91+
.menu-toggle {
92+
display: flex;
93+
}
94+
}
95+
96+
/* Animasi Hamburger Menu */
97+
.menu-toggle.open span:first-child {
98+
transform: rotate(45deg) translate(5px, 5px);
99+
}
100+
101+
.menu-toggle.open span:nth-child(2) {
102+
opacity: 0;
103+
}
104+
105+
.menu-toggle.open span:last-child {
106+
transform: rotate(-45deg) translate(5px, -5px);
107+
}
108+
109+
/* Efek slide-up */
110+
.slide-up {
111+
opacity: 0;
112+
transform: translateY(50px);
113+
transition: opacity 0.8s ease, transform 0.8s ease;
114+
}
115+
116+
.slide-up.visible {
117+
opacity: 1;
118+
transform: translateY(0);
50119
}
51120

121+
52122
/* Animasi */
53123
.fade-in {
54124
animation: fadeIn 2s ease-in;
@@ -68,6 +138,18 @@ nav ul li a:hover {
68138
to { transform: translateY(0); opacity: 1; }
69139
}
70140

141+
/* Animasi Scroll */
142+
.scroll-reveal {
143+
opacity: 0;
144+
transform: translateY(50px);
145+
transition: opacity 0.8s ease, transform 0.8s ease;
146+
}
147+
148+
.scroll-reveal.visible {
149+
opacity: 1;
150+
transform: translateY(0);
151+
}
152+
71153
/* Bagian Tentang Saya */
72154
#about {
73155
text-align: center;
@@ -76,8 +158,13 @@ nav ul li a:hover {
76158

77159
.project-image.small {
78160
width: 150px;
79-
border-radius: 50%;
161+
border-radius: 10%;
80162
margin: 20px 0;
163+
transition: transform 0.5s ease;
164+
}
165+
166+
.project-image.small:hover {
167+
transform: scale(1.1) rotate(5deg);
81168
}
82169

83170
/* Bagian Skill */
@@ -100,9 +187,9 @@ nav ul li a:hover {
100187
align-items: center;
101188
max-width: 200px;
102189
padding: 15px;
103-
background: white;
190+
background: #222;
104191
border-radius: 12px;
105-
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
192+
box-shadow: 0 4px 8px rgba(255, 255, 255, 0.1);
106193
transition: transform 0.3s;
107194
}
108195

@@ -113,11 +200,12 @@ nav ul li a:hover {
113200
}
114201

115202
.skill-item:hover {
116-
transform: translateY(-10px);
203+
transform: translateY(-10px) scale(1.1);
117204
}
118205

119206
/* Bagian Proyek */
120207
#projects {
208+
text-align: center;
121209
padding: 3rem 1rem;
122210
}
123211

@@ -130,17 +218,41 @@ nav ul li a:hover {
130218
width: 100%;
131219
max-width: 400px;
132220
border-radius: 12px;
221+
transition: transform 0.5s ease;
222+
}
223+
224+
.project img:hover {
225+
transform: scale(1.1) rotate(-3deg);
133226
}
134227

135228
/* Bagian Kontak */
136229
#contact {
137230
text-align: center;
138231
padding: 3rem 1rem;
139-
background: #4e54c8;
232+
background: #000;
140233
color: white;
141234
}
142235

143236
#contact p {
144237
margin: 10px 0;
145238
}
146239

240+
/* Responsif */
241+
@media (max-width: 768px) {
242+
h1 {
243+
font-size: 2rem;
244+
}
245+
246+
.skill-container {
247+
flex-direction: column;
248+
align-items: center;
249+
}
250+
251+
nav ul {
252+
flex-direction: column;
253+
}
254+
255+
.project img {
256+
max-width: 300px;
257+
}
258+
}

0 commit comments

Comments
 (0)