-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdrotext.html
More file actions
298 lines (277 loc) · 7.39 KB
/
drotext.html
File metadata and controls
298 lines (277 loc) · 7.39 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
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
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
<!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>
/*=================================================
Removing the default look of checkbox
================================================*/
input[type=checkbox]{
display:none;
}
/*=================================================
Hiding the content and styling
===================================================*/
.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);
}
/*=================================================
Displaying the content as the menu is clicked
===================================================*/
.dropdown-menu:checked~ .dropdown-content{
display:block;
}
/*=================================================
Styling the navbar header
===================================================*/
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;
}
body{
background-color:#6abce3;
margin:0px;
padding:0px;
font-family: 'Open Sans', sans-serif;
}
/*=================================================
Styling the dropdown menu
===================================================*/
.dropdown{
float:right;
padding-top:25px;
}
.dropdown label{
padding: 25px 30px;
font-size:18px;
color:white;
cursor: pointer;
}
.dropdown-content a {
float: none;
padding: 12px 16px;
text-decoration: none;
border-bottom:1px solid white;
display: block;
}
/*=================================================
Adding hover effect
===================================================*/
.dropdown-menu:hover~label{
background-color:#2581DC;
}
nav a:hover{
background-color:#2581DC;
transition: all 0.5s ease 0s;
}
/*=================================================
Styling the heading
===================================================*/
h1{
font-size:26px;
padding:40px 0px;
text-align:center;
font-weight:700;
}
h1 span{
font-weight:200;
}
/*=================================================
Styling the contents section
==================================================*/
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:18px;
line-height:22px;
color:white;
text-align:justify;
}
.hamburger-icon{
display:none;
}
/*=================================================
Extra adjustmens
==================================================*/
nav{
margin-right:12%;
}
@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 Menu
==================================================*/
.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),
background 0.5s cubic-bezier(0.77,0.2,0.05,1.0),
opacity 0.55s ease;
}
label {
float:right;
padding:8px 0px;
display:inline-block;
cursor:pointer;
}
/*=================================================
Displaying the menus
==================================================*/
input[type=checkbox]:checked ~ nav{
display:block;
}
/*=================================================
Designs for displaying the menus
==================================================*/
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%;
box-shadow:0px 0px 0px 0px;
}
.dropdown-content a{
border:0px;
border-bottom:0px;
}
.dropdown label{
width:100%;
float:none;
font-size:15px;
padding:10px 20px;
}
/*=================================================
Converting the lines to CROSS
==================================================*/
.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);
}
/*=================================================
Removing this line from display as
for cross we need only two lines
==================================================*/
.hamburger-menu:checked ~ label div:nth-last-child(3){
opacity:0;
}
}
</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>
<div class="dropdown-content">
<a href="#">Node.js</a>
<a href="#">React.js</a>
<a href="#">Angular.js</a>
</div>
</div>
<a href="#home">CSS</a>
<a href="#news">HTML</a>
</nav>
<section>
</header>
<section id="HTML" class="content">
<h2>HTML</h2>
<p>In this tutorial, we are building a dropdown navigation menu. For this we are using simple HTML and CSS without JavaScript or some dynamic and advanced frameworks. To behave as a dropdown menu, we are using the feature of checkbox which can be checked and unchecked. </p>
</section>
<section id="CSS" class="content">
<h2>CSS</h2>
<p>This dropdown navigation Menu is a simple example built with Pure CSS and HTML. Since the button doesn't allow unclickable property without using JavaScript, we are manipulating the CSS styles of the checkbox button to make it behave as a dropdown navigation menu.</p>
</section>
<section id="JavaScript" class="content">
<h2>JavaScript</h2>
<p>In this tutorial, we are building a beautiful and responsive dropdown navigation menu without using Javascript. We are using media queries for responsiveness changing the CSS on several breakpoints to make it responsive on varying width.</p>
</section>
</body>
</html>