I have made this using Div only no ul or li, it is working but I need some clarifications. As i understand tne number of div = /div, in my
div class=“second” i have 2 div and 4 /div. If i remove even one /div the nav does not work as required.
HTML
<!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">
<link rel="stylesheet" href="area1.css">
<title>Document</title>
</head>
<body>
<nav>
<a href="#home">Home</a>
<a href="#news">News</a>
<div class="primary">
<button class="dropbtn">Products </button>
<div class="dropdown-content">
<div class="second">
<a href="##">Access-Type</a>
<div class="second-content">
<a href="##">Face</a>
<a href="##">Thumb</a>
<a href="##"> Card</a>
</div>
</div>
<div>
</div>
<div class="second">
<a href="##">PBX Type</a>
<div class="second-content">
<a href="##">Analogue PBX</a>
<a href="##">Digital PBX</a>
<a href="##"> IP PBX</a>
</div>
</div>
</div>
</div>
<div class="primary">
<button class="dropbtn">Services </button>
<div class="dropdown-content">
<a href="#">Acces Control</a>
<div class="second">
<a href="##">PBX Type</a>
<div class="second-content">
<a href="##">Analogue PBX</a>
<a href="##">Digital PBX</a>
<a href="##"> IP PBX</a>
</div>
</div>
</div>
</div>
<div class="primary">
<button class="dropbtn">Contact Us </button>
</div>
</nav>
</body>
</html>
CSS
*{
margin: 0;
padding: 0;
box-sizing: border-box;
}
nav {
overflow: hidden;
background-color: #333;
}
nav a {
float: left;
font-size: 16px;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
.primary {
float: left;
overflow: hidden;
}
.primary .dropbtn {
font-size: 16px;
border: none;
outline: none;
color: white;
padding: 14px 16px;
background-color: inherit;
font-family: inherit;
margin: 0;
}
.primary a {
font-size: 16px;
border: none;
outline: none;
color: white;
padding: 14px 16px;
background-color: inherit;
font-family: inherit;
margin: 0;
}
nav a:hover, .primary:hover {
background-color: red;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
box-shadow: 0px 8px 16px 0px rgba(36, 13, 168, 0.2);
z-index: 1;
}
.dropdown-content a , .dropbtn{
float: none;
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
}
.dropdown-content a:hover , .dropbtn:hover {
background-color: red;
}
.primary:hover .dropdown-content {
display: block;
}
.second {
float: left;
overflow: hidden;
min-width: 140px;
}
.second-content {
display: none;
position: absolute;
background-color: #f9f9f9;
}
.second-content a {
float: none;
color: black;
text-decoration: none;
display: block;
text-align: left;
}
.second-content a:hover {
background-color: #ddd;
}
.second:hover .second-content {
position: relative;
display: table-cell;
right:-30%; top:40%;
background-color: lightgrey;
float: left;
min-width: 200px;
}