<html>
<head>
<title>Navigation Bar With Dropdown Menu</title>
<link href="https://fonts.googleapis.com/css?family=Raleway" rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>
<div id="ribbon">New Nav Bar</div>
<div id="container">
<nav>
<div id="logo">
Company
</div>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li class="dropdown" onmouseover="hover(this);" onmouseout="out(this);"><a href="#">Gallery <i class="fa fa-caret-down"></i></a>
<div class="dd">
<div id="up_arrow"></div>
<ul>
<li><a href="#">2019</a></li>
<li><a href="#">2018</a></li>
<li><a href="#">2017</a></li>
</ul>
</div>
</li>
<li><a href="#">Contact</a></li>
<li class="dropdown"><a href="#">Others <i class="fa fa-caret-down"></i> </a>
<div class="dd">
<div id="u_a_c"><div id="up_arrow"></div></div>
<ul>
<li><a href="#">DOCS</a></li>
<li><a href="#">API</a></li>
<li><a href="#">PROJECTS</a></li>
</ul>
</div>
</ul>
</nav>
</div>
</body>
</html>
* {
margin:0;
padding:0;
}
body {
background-color:#0088ff;
font-family: 'Raleway', sans-serif;
}
#ribbon {
position:absolute;
background-color:red;
color:white;
top:40px;
left:-30px;
width:160px;
transform:rotate(-45deg);
text-align:center;
}
#container {
position:relative;
width:80%;
margin:5% auto;
background-color:black;
box-shadow: -2px -2px 5px white,2px -2px 5px white;
}
#container > nav {
width:100%;
display:flex;
max-height:60px;
}
#logo {
line-height:60px;
font-size:30px;
padding: 0 50px;
color: white;
width:40%;
letter-spacing:2px;
text-shadow:2px 2px 5px;
}
#container > nav > ul {
margin:0;
paddding:0;
list-style-type:none;
display:flex;
position:absolute;
right:50px;
/* min-width:60%; */
}
#container > nav > ul > li {
line-height:60px;
margin: 0 0px;
padding:0;
text-align:center;
display:inline-block;
/* background-color:green; */
min-width:120px;
}
#container > nav > ul > li > a {
position:relative;
/* background-color:red; */
margin: 0 20px;
color:white;
}
#container > nav > ul > li:hover {
border-bottom: 2px solid white;
background-color: #0088ff;
}
#container > nav > ul > .dropdown:hover {
border-bottom:none;
}
#container > nav > ul > .dropdown:hover > .dd
{
display:block;
}
.dropdown:hover > a .fa-caret-down {
display:none;
}
a {
text-decoration:none;
}
#container > nav > ul > li > div {
position:absolute;
padding: 0 10px;
background-color:black;
display:none;
background-color:aliceblue;
min-width:100px;
}
#container > nav > ul > li > div > ul {
margin:0px 0 10px 0;
padding:0;
list-style:none;
}
#u_a_c {
position:relative;
width:100%;
/* background-color:red; */
}
#up_arrow {
position:relative;
width:20px;
height:20px;
left:42%;
top:-10px;
background-color:aliceblue;
transform:rotate(45deg);
}
#container > nav > ul > li> div > ul > li:hover {
background-color:rgba(0,0,0,0.2);
}
#container > nav > ul > li > div > ul > li > a {
padding : 5px;
color:black;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.