-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmyNavbar.html
154 lines (154 loc) · 3.74 KB
/
myNavbar.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Navbar</title>
<style>
:root {
--bgColor: #dddddd;
--boxShadow1: rgba(244, 244, 244, 0.7);
--boxShadow2: rgba(136, 136, 136, 0.7);
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: sans-serif;
}
body {
background-color: var(--bgColor);
}
.navbar {
background-color: var(--bgColor);
height: 80px;
width: 100%;
}
.navbar nav {
display: flex;
/* flex-wrap: wrap; */
justify-content: space-between;
padding: 15px;
}
.navbar-links {
display: flex;
align-items: center;
}
.navbar-links li {
list-style: none;
padding: 0 20px;
position: relative;
}
.navbar-links li img {
height: 20px;
width: 20px;
position: relative;
top: 7px;
left: -18px;
cursor: pointer;
}
.navbar-links li a {
text-decoration: none;
color: black;
font-weight: bold;
}
.navbar-links li:hover .dropdown-content {
display: block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: var(--bgColor);
/* box-shadow: 0px 8px 16px var(--boxShdowColor); */
z-index: 1;
}
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
}
.dropdown-content a:hover {
background-color: var(--boxShadow2);
}
.navbar-search-box {
display: flex;
align-items: center;
border-radius: 30px;
overflow: hidden;
}
.navbar-search-box li {
list-style: none;
}
.navbar-search-box li input {
padding: 8px 30px 8px 8px;
border-radius: 30px;
border-style: none;
background-color: var(--bgColor);
box-shadow: 0 0 3px 3px var(--bgColor),
inset 1px 1px 2px 1px var(--boxShadow2),
inset -1px -1px 2px 3px var(--boxShadow1);
width: 200px;
}
.navbar-search-box li input:focus {
outline: none;
}
.navbar nav ul li img {
height: 20px;
width: 20px;
position: relative;
top: 7px;
left: -28px;
cursor: pointer;
}
@media screen and (max-width: 600px) {
.navbar nav {
display: flex;
flex-direction: column;
align-items: center;
}
.navbar nav ul {
margin: 10px;
}
.navbar-links {
display: flex;
flex-direction: column;
}
.navbar-links li {
margin: 10px;
}
}
</style>
</head>
<body>
<header class="navbar">
<nav>
<ul class="navbar-links">
<li>
<span><a href="#">Home</a></span>
</li>
<li><a href="#">Blog</a></li>
<li class="dropdown">
<a href="#">Service</a>
<div class="dropdown-content">
<a href="#">Service 1</a>
<a href="#">Service 2</a>
<a href="#">Service 3</a>
</div>
</li>
<li><a href="#">About</a></li>
</ul>
<ul class="navbar-search-box">
<li>
<input
type="text"
placeholder="Search"
name="search"
id="search"
/><img src="search_black.png" alt="Search icon" />
</li>
</ul>
</nav>
</header>
</body>
</html>