Live Preview Source Code in GitHub
HTML Code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport"
content="width=device-width, initial-scale=1.0">
<title>Drop Down Menu</title>
<link rel="stylesheet" href="style.css">
<link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/
font-awesome/6.3.0/css/all.min.css"
integrity="sha512-SzlrxWUlpfuzQ+pcUCosxcglQRNAq/
DZjVsC0lE40xsADsfeQoEypE+enwcOiGjk/bSuGGKHEyjSoQ1zVisanQ=="
crossorigin="anonymous" referrerpolicy="no-referrer" />
</head>
<body>
<!--=============Drop DOWN Menu ============== -->
<nav class="menu_bar">
<label class="logo">sWebCode</label>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Service
<i class="fas fa-caret-down"></i></a>
<div class="dropdown_menu">
<ul>
<li><a href="">SEO & SEM</a></li>
<li><a href="">Social Media</a></li>
<li><a href="">Video</a></li>
<li><a href="">WEB SERVICES</a></li>
<li><a href="">Website Development
<i class="fas fa-caret-right"></i></a>
<div class="dropdown_menu_1">
<ul>
<li><a href="">Landing Page</a></li>
<li><a href="">Porfolio Website</a></li>
<li><a href="">React website</a></li>
<li><a href="">Dynamic website</a></li>
<li><a href="">Blog Website</a></li>
</ul>
</div>
</li>
</ul>
</div>
</li>
<li><a href="#">Blog</a></li>
<li><a href="#">Contact</a></li>
</ul>
</nav>
<!--==============Drop DOWN Menu============= -->
<section class="hero_section">
</section>
</body>
</html>
CSS Code
:root {
--color-primary: #0073ff;
--color-white: #e9e9e9;
--color-black: #141d28;
--color-black-1: #212b38;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: sans-serif;
}
.menu_bar {
background-color: var(--color-black);
height: 80px;
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 5%;
}
.logo {
color: var(--color-white);
font-size: 30px;
}
.menu_bar ul {
list-style: none;
display: flex;
}
.menu_bar ul li {
padding: 10px 29px;
position: relative;
}
.menu_bar ul li a {
color: var(--color-white);
text-decoration: none;
font-size: 20px;
transition: all 0.3s;
}
.menu_bar ul li a:hover {
color: var(--color-primary);
}
.dropdown_menu {
display: none;
}
.menu_bar ul li:hover .dropdown_menu {
display: block;
position: absolute;
left: 0;
top: 100%;
background-color: var(--color-black);
}
.menu_bar ul li:hover .dropdown_menu ul {
display: block;
margin: 10px;
}
.menu_bar ul li:hover .dropdown_menu ul li {
width: 200px;
padding: 10px;
}
.fas {
float: right;
margin-left: 10px;
padding-top: 5px;
}
.dropdown_menu_1 {
display: none;
}
.dropdown_menu ul li:hover .dropdown_menu_1 {
display: block;
position: absolute;
top: 10px;
left: 127px;
background-color: var(--color-black);
}
.hero_section {
background-image: url("pexels-kristina-paukshtite-712876.jpg");
background-position: center;
width: 100%;
height: 100vh;
background-size: cover;
}
Post a Comment