1<!DOCTYPE html>
2<html lang="en">
3<head>
4 <meta charset="UTF-8">
5 <title>Navbar</title>
6
7<style>
8body {
9margin: 0;
10}
11.navbar{
12padding: 15px;
13background-color: grey;
14display: flex;
15justify-content: space-between;
16font-size: 30px;
17text-decoration: none;
18color: #fff;
19}
20 .nav-item {
21 margin: 0;
22 padding: 0;
23 flex: 1;
24 max-width: 50%;
25 display: flex;
26 justify-content: space-evenly;
27 font-size: 25px;
28 }
29 .nav-link {
30 display: inline-block;
31 }
32 a{
33 text-decoration: none;
34 color: #fff;
35 }
36
37 @media (max-width: 715px) {
38 .nav-item {
39 flex-direction: column;
40 align-items: center;
41 }
42 .nav-link {
43 margin: 5px 0;
44 }
45 }
46</style>
47
48
49</head>
50<body>
51<nav class="navbar">
52 <a class="brand" href="">Navebar</a>
53 <ul class="nav-item">
54 <li class="nav-link"><a href="">Learn more</a></li>
55 <li class="nav-link"><a href="">About</a></li>
56 <li class="nav-link"><a href="">Contact</a></li>
57 </ul>
58 <a class="home" href="">Home</a>
59</nav>
60</body>
61</html>
1/* This is the css for the nav bar*/
2
3nav{
4
5 display: flex;
6 align-items: center;
7 position: sticky;
8 top: 0px;
9 align-items: center;
10 min-height: 8vh;
11
12}
13
14nav::before{
15 content: "";
16 background-color: rgb(255, 255, 255);
17 position: absolute;
18 top:0px;
19 left:0px;
20 height: 100%;
21 width:100%;
22 z-index: -1;
23 opacity: 0.4;
24}
25
26
27#logo{
28 color:rgb(0, 0, 0);
29 text-transform: uppercase;
30 letter-spacing: 5px;
31 margin-left: 20px;
32 margin-right: 60px;
33 font-size: 22px;
34}
35
36.nav-links{
37 display: flex;
38 justify-content: space-around;
39 width: 18%;
40}
41.nav-links li{
42 list-style: none;
43 display: inline-block;
44
45}
46
47#N1{
48 margin-left: 20px;
49 margin-right: 10px;
50}
51#N2{
52 padding-left: 5px;
53}
54
55.nav-links a{
56 color:rgb(0, 0, 0);
57 font-size: 20px;
58 text-decoration: none;
59 letter-spacing: 3px;
60 font-weight: bold;
61 width: 150px;
62 display: inline-block;
63 text-align: center;
64
65}
66
67.cool-link::after{
68 content: '';
69 display: block;
70 width: 0;
71 height: 2px;
72 background: rgb(0, 0, 0);
73 transition: width .3s;
74}
75.cool-link:hover::after{
76 width:100%;
77 transition:width .3s;
78}
79/* designing of the buttons */
80.btn{
81 border: 1px solid #3498db;
82 background: none;
83 padding: 10px 20px;
84 font-size: 25px;
85 font-family: "montserrat";
86 cursor: pointer;
87 margin: 10px;
88 transition: 0.8s;
89 position: relative;
90 overflow: hidden;
91 text-decoration: none;
92 }
93 .btn::before{
94 content: "";
95 position: absolute;
96 left: 0;
97 width: 100%;
98 height: 0%;
99 background: #3498db;
100 z-index: -1;
101 transition: 0.8s;
102
103 }
104 .btn a{
105 text-decoration: none;
106 color:#fff;
107
108 }
109 .btn4{
110 color: #fff;
111
112 }
113
114 .btn4:hover{
115 color:black ; /* change the color*/
116 }
117
118
119 .btn4::before{
120 bottom: 0;
121 border-radius: 50% 50% 0 0;
122 }
123 .btn4::before{
124 height: 180%;
125 }
126
127 .btn4:hover::before{
128 height: 0%;
129 }
130
131
132/* button ends */
133
134.burger{
135 position: absolute;
136 right: 30px;
137 cursor: pointer;
138 display: none;
139}
140.burger div{
141 width: 25px;
142 height: 3px;
143 background-color: rgb(5, 5, 5);
144 margin: 5px;
145}
146
147
148/* Nav bar in the mobile version*/
149
150@media screen and (max-width: 670px)
151{
152 body{
153 overflow-x: hidden;
154 }
155
156 .nav-links{
157 position: absolute;
158 right: 0px;
159 height: 25vh;
160 top: 8vh;
161 background-color: rgb(241, 241, 241);
162
163
164 display: flex;
165 flex-direction: column;
166 align-items: center;
167 width: 50%;
168 transform: translateX(100%);
169 transition: transform 0.3s ease-in;
170 /* canging the z index of the */
171
172 }
173
174 .nav-links a{
175 color:rgb(0, 0, 0);
176 font-size: 20px;
177 text-decoration: none;
178 letter-spacing: 3px;
179 font-weight: bold;
180
181 display: inline-block;
182 width: 150px;
183 text-align: center;
184 margin-left: 50px;
185 }
186
187 .nav-active{
188 transform: translateX(0%);
189 }
190 .burger{
191 display: block;
192 }
193
194}