-
Notifications
You must be signed in to change notification settings - Fork 0
/
dropdown_navigation.html
283 lines (255 loc) · 5.52 KB
/
dropdown_navigation.html
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
body{
background-color:#6abce3;
margin:0px;
padding:0px;
font-family: 'Open Sans', sans-serif;
}
header{
overflow:hidden;
background-color:#262626;
margin-bottom:50px;
}
#logo{
font-size:20px;
text-transform:uppercase;
color:white;
font-weight:bold;
float:left;
padding: 25px 20px;
margin-left:12%;
}
nav a{
float:right;
text-decoration:none;
color:white;
font-size:18px;
padding: 25px 35px;
display:inline-block;
transition: all 0.5s ease 0s;
}
.dropdown{
float:right;
padding-top:25px;
}
.dropdown label{
padding: 27px 30px;
font-size:18px;
color:white;
cursor: pointer;
}
.dropdown-content {
display: none;
position: absolute;
top:182px;
background-color: #262626;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
}
nav{
margin-right:12%;
}
.dropdown-content a {
float: none;
padding: 12px 16px;
text-decoration: none;
border-bottom:1px solid white;
display: block;
text-align: left;
}
input[type=checkbox], .hamburger-icon{
display:none;
}
.dropdown-menu:checked~ .dropdown-content{
display:block;
}
.dropdown-menu:hover~label{
background-color:#2581DC;
}
nav a:hover{
background-color:#2581DC;
transition: all 0.5s ease 0s;
}
section{
width:100%;
max-width:1000px;
margin:0px auto;
}
.content{
margin-bottom:60px;
width:750px;
}
.content h2{
font-size:18px;
font-weight:500;
color:#002e5b;
border-bottom:1px solid grey;
padding-bottom:10px;
margin-bottom:10px;
}
.content p{
font-size:14px;
line-height:22px;
color:white;
text-align:justify;
}
h1{
margin:0px auto;
font-size:26px;
padding:40px 0px;
color:black;
text-align:center;
font-weight:700;
}
h1 span{
font-weight:200;
}
@media only screen and (max-width: 980px) {
nav {
display:none;
width:100%;
padding:0px;
margin-left:10%;
}
header{
padding:22px 0px;
}
#logo{
padding:0;
}
.hamburger-icon{
display:block;
margin-right:100px;
}
.hamburger-icon div{
width: 33px;
height: 4px;
margin-bottom: 5px;
position: relative;
background: #cdcdcd;
border-radius: 3px;
transform-origin: 4px 0px;
transition: transform 0.5s cubic-bezier(0.77,0.2,0.05,1.0),
opacity 0.55s ease;
}
input[type=checkbox]:checked ~ nav{
display:block;
}
input[type=checkbox] {
display:none;
}
.hamburger-menu:checked ~ label div:nth-last-child(1){
opacity: 1;
transform: translate(0px,-15px) rotate(45deg);
}
.hamburger-menu:checked ~ label div:nth-last-child(2){
opacity: 1;
transform: rotate(-45deg) translate(-11px, 5px);
}
.hamburger-menu:checked ~ label div:nth-last-child(3){
opacity:0;
}
label {
float:right;
padding:8px 0px;
display:inline-block;
cursor:pointer;
}
nav a{
width:100%;
float:none;
padding:0px;
color:#FFF;
font-size:15px;
padding:10px 20px;
}
.dropdown{
width:100%;
float:none;
}
.dropdown-content{
position:relative;
top:0px;
left:15px;
width:100%;
}
.dropdown-content a{
border:0px;
box-shadow: 0px;
border-bottom:0px;
}
.dropdown label{
width:100%;
float:none;
padding:10px 20px;
}
}
@media only screen and (max-width: 980px) {
.content{width:70%;}
}
@media only screen and (max-width: 568px) {
h1{padding:25px 0px;}
h1 span{display:block;}
}
@media only screen and (max-width: 480px) {
section {max-width: 90%;}
}
@media only screen and (max-width: 360px) {
h1{font-size:20px;}
label{padding:5px 0px;}
#logo{font-size: 20px;}
}
@media only screen and (max-width: 320px) {
h1 {padding: 20px 0px;}
}
</style>
</head>
<body>
<h1><span>Responsive Dropdown Menu</span> Using Only CSS</h1>
<header>
<section>
<div id="logo">OnAirCode</div>
<input type="checkbox" id="toggle" class="hamburger-menu">
<label for="toggle" class="hamburger-icon">
<div></div>
<div></div>
<div></div>
</label>
<nav>
<div class="dropdown">
<input type="checkbox" id="checkbox_id" class="dropdown-menu">
<label for="checkbox_id">
JavaScript
<i class="fa fa-caret-down"></i>
</label>
<!-- <button class="dropbtn">
</button> -->
<div class="dropdown-content">
<a href="#">Node.js</a>
<a href="#">Link 2</a>
<a href="#">Link 3</a>
</div>
</div>
<a href="#home">CSS</a>
<a href="#news">Home</a>
</nav>
<section>
</header>
<section id="HTML" class="content">
<h2>HTML</h2>
<p>In this tutorial, we have built an example of responsive navigation menu with HTML and CSS only. Using the andchor tab we have navigated within the page only. But if you prefer you can change the href value to any other external link to navigate to the link. </p>
</section>
<section id="CSS" class="content">
<h2>CSS</h2>
<p>This navigation Menu is a simple example built with Pure CSS and HTML</p>
</section>
<section id="JavaScript" class="content">
<h2>JavaScript</h2>
<p>In this tutorial, we have built an example of responsive navigation menu without using Javascript. We've made use of media queries and changed the CSS on several checkpoint to make it responsive with differnt width.</p>
</section>
</body>
</html>