-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTask1.html
More file actions
129 lines (115 loc) · 2.69 KB
/
Copy pathTask1.html
File metadata and controls
129 lines (115 loc) · 2.69 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Responsive Landing Page</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: Arial, sans-serif;
}
body {
min-height: 200vh; /* Scroll effect dikhane ke liye */
}
/* Navigation Bar */
nav {
position: fixed;
top: 0;
left: 0;
width: 100%;
background: transparent;
padding: 15px 30px;
display: flex;
justify-content: space-between;
align-items: center;
transition: background 0.3s ease, box-shadow 0.3s ease;
z-index: 1000;
}
nav.scrolled {
background: #111;
box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}
nav .logo {
color: white;
font-size: 1.5em;
font-weight: bold;
}
nav ul {
list-style: none;
display: flex;
gap: 20px;
}
nav ul li a {
text-decoration: none;
color: white;
font-size: 1em;
transition: color 0.3s ease, transform 0.3s ease;
}
nav ul li a:hover {
color: #ff9800;
transform: scale(1.1);
}
/* Responsive */
@media (max-width: 768px) {
nav ul {
flex-direction: column;
position: absolute;
top: 60px;
right: 0;
background: #111;
padding: 10px;
display: none;
}
nav ul.show {
display: flex;
}
.menu-toggle {
display: block;
cursor: pointer;
color: white;
}
}
@media (min-width: 769px) {
.menu-toggle {
display: none;
}
}
</style>
</head>
<body>
<nav>
<div class="logo">MyLogo</div>
<div class="menu-toggle">☰</div>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Services</a></li>
<li><a href="#">Contact</a></li>
</ul>
</nav>
<section style="padding: 100px 30px; color: white; background: #222;">
<h1>Welcome to My Landing Page</h1>
<p>This is a responsive landing page with an interactive navigation menu.</p>
</section>
<script>
const nav = document.querySelector("nav");
const toggle = document.querySelector(".menu-toggle");
const menu = document.querySelector("nav ul");
// Scroll color change
window.addEventListener("scroll", () => {
if (window.scrollY > 50) {
nav.classList.add("scrolled");
} else {
nav.classList.remove("scrolled");
}
});
// Mobile menu toggle
toggle.addEventListener("click", () => {
menu.classList.toggle("show");
});
</script>
</body>
</html>