Hover dropdown menu appears left instead of directly underneath Links anchor - html

This is probably very simple to figure out, but when hovering over the Links element, the dropdown menu appears to the left instead of vertically dropping down beneath the Links anchor when hovering over it. Thanks.
[https://jsfiddle.net/kolinio/p9Lea8g4/6/][1]
CSS
ul {
}
li a,
.dropbtn {
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
}
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
}
.dropdown-content a:hover {
background-color: #f1f1f1
}
.dropdown:hover .dropdown-content {
display: block;
}
ul {
margin: 0px;
padding: 0px;
border: 0px;
vertical-align: middle;
background-color: #a2ded0;
}
ul#nlist {
text-align: center;
position: relative;
top: 50%;
transform: translateY(-50%);
}
ul#nlist li {
display: inline;
}
HTML
<ul id='nlist'>
<li><a href='#' class='home'>Home</a></li>
<li><a href='#' class='about'>About</a></li>
<li class="dropdown">
Links
<div class="dropdown-content">
Link 1
Link 2
Link 3
</div>
</li>
<li><a href='#' class='volunteer'>Volunteer</a></li>
<li><a href='#' class='contact'>Contact</a></li>
<li><a href='#' class='calender'>Calender</a></li>
</ul>
<!-- end snippet -->
li a,
.dropbtn {
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
}
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
}
.dropdown-content a:hover {
background-color: #f1f1f1
}
.dropdown:hover .dropdown-content {
display: block;
}
ul {
margin: 0px;
padding: 0px;
border: 0px;
vertical-align: middle;
}
ul#nlist {
text-align: center;
position: relative;
top: 50%;
transform: translateY(-50%);
}
ul#nlist li {
display: inline;
}
_______________________________________________________________>>>
<ul id='nlist'>
<li><a href='#' class='home'>Home</a></li>
<li><a href='#' class='about'>About</a></li>
<li class="dropdown">
Links
<div class="dropdown-content">
Link 1
Link 2
Link 3
</div>
</li>
<li><a href='#' class='volunteer'>Volunteer</a></li>
<li><a href='#' class='contact'>Contact</a></li>
<li><a href='#' class='calender'>Calender</a></li>
</ul>
[1]: https://jsfiddle.net/kolinio/p9Lea8g4/6/

Try This one.
Html
<ul id='nlist'>
<li><a href='#' class='home'>Home</a></li>
<li><a href='#' class='about'>About</a></li>
<li class="dropdown">
Links
<ul class="dropdown-content">
<li>Link 1</li>
<li>Link 2</li>
<li>Link 3</li>
</ul>
</li>
<li><a href='#' class='volunteer'>Volunteer</a></li>
<li><a href='#' class='contact'>Contact</a></li>
<li><a href='#' class='calender'>Calender</a></li>
</ul>
CSS:
ul {
}
.dropdown{
position:relative;
}
li a, .dropbtn {
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
left:-9999px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
}
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
}
.dropdown-content a:hover {background-color: #f1f1f1}
.dropdown:hover .dropdown-content {
display: block;
left:0px;
}
ul {
background-color: #a2ded0;
margin: 0px;
padding: 0px;
border: 0px;
vertical-align: middle;
}
ul#nlist {
text-align: center;
position: relative;
top: 50%;
transform: translateY(-50%);
}
ul#nlist li {
display: inline;
}
https://jsfiddle.net/p9Lea8g4/7/

Related

How to float search icon to the right

How do i float the font awesome search icon to the right next to sign up.
Here is a screenshot of my nav bar, so you know what i am referring too:
https://imgur.com/rE23FfB
I have search the internet for tutorials and they all say to use float: right; but that seems to not work
body {
margin: 0;
padding: 0;
margin-top: 130px;
overflow-x: hidden;
}
.nav-menu a img {
float: left;
margin-left: 10px;
}
.nav-menu ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: rgba(0, 0, 0, 0.9);
margin-top: -130px;
}
.nav-menu li {
float: left;
}
.nav-menu li a,
.dropbtn {
display: inline-block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
.nav-menu li a:hover,
.dropdown:hover .dropbtn {
border-top: 2px solid #ff0000;
}
.nav-menu li.dropdown {
display: inline-block;
}
.nav-menu .dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
z-index: 1;
}
.nav-menu .dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
}
.nav-menu .dropdown-content a:hover {
background-color: #ff0000;
color: #fff;
}
.nav-menu .dropdown:hover .dropdown-content {
display: block;
}
.nav-menu li.social {
float: right;
}
<div class="nav-menu">
<ul>
<img src="img/logo.jpg" style="width:50px">
<li class="dropdown">
Games
<div class="dropdown-content">
Link 1
Link 2
Link 3
</div>
</li>
<li class="dropdown">
Crews
<div class="dropdown-content">
Link 1
Link 2
Link 3
</div>
</li>
<li>Jobs</li>
<li>Photos</li>
<li>Videos</li>
<li>Events</li>
<li>News</li>
<li class="social">
Sign In
Sign Up
<li><i class="fas fa-search"></i></li>
</ul>
The problem is your <li> wrapping the search icon. This is an invalid code. <li> cannot be a children of an <li>. Change it to just an <a> element
body {
margin: 0;
padding: 0;
margin-top: 130px;
overflow-x: hidden;
}
.nav-menu a img {
float: left;
margin-left: 10px;
}
.nav-menu ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: rgba(0, 0, 0, 0.9);
margin-top: -130px;
}
.nav-menu li {
float: left;
}
.nav-menu li a,
.dropbtn {
display: inline-block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
.nav-menu li a:hover,
.dropdown:hover .dropbtn {
border-top: 2px solid #ff0000;
}
.nav-menu li.dropdown {
display: inline-block;
}
.nav-menu .dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
z-index: 1;
}
.nav-menu .dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
}
.nav-menu .dropdown-content a:hover {
background-color: #ff0000;
color: #fff;
}
.nav-menu .dropdown:hover .dropdown-content {
display: block;
}
.nav-menu li.social {
float: right;
}
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">
<div class="nav-menu">
<ul>
<li><img src="img/logo.jpg" style="width:50px"></li>
<li class="dropdown">
Games
<div class="dropdown-content">
Link 1
Link 2
Link 3
</div>
</li>
<li class="dropdown">
Crews
<div class="dropdown-content">
Link 1
Link 2
Link 3
</div>
</li>
<li>Jobs</li>
<li>Photos</li>
<li>Videos</li>
<li>Events</li>
<li>News</li>
<li class="social">
Sign In
Sign Up
<i class="fas fa-search"></i>
</li>
</ul>
</div>
I know I'm a little late to the question - but I have an improved solution (at least I think so)!
The syntax on the previous answer is still a little incorrect. You should also try to make your dropdowns into nested ul's. :-)
By using the display: flex and align-items: center on the .nav-menu, you will be aligning all the elements up without the use of float (which I tend to avoid anyway as it often makes your code behave like you would not expect).
I've also added margin-left:auto for you on your .social container, it will push all your social to the end of the parent.
EDIT:
If you use border-top: transparent on the menu items, this makes sure that the text doesn't move when you add in a coloured border on :hover - so you're essentially just showing the colour.
html,
body {
margin: 0;
padding: 0;
}
.nav-menu {
display: flex;
align-items: center;
background-color: rgba(0, 0, 0, 0.9);
}
.nav-menu img {
margin: 0 10px;
}
.nav-menu>ul {
list-style-type: none;
margin: 0;
padding: 0;
display: flex;
}
ul.social {
margin-left: auto;
}
.nav-menu li a,
.dropbtn {
display: inline-block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
border-top: 2px solid transparent;
}
.nav-menu li a:hover,
.dropdown:hover .dropbtn {
border-top: 2px solid #ff0000;
}
.nav-menu li.dropdown {
display: inline-block;
}
.nav-menu .dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
z-index: 1;
list-style: none;
margin: 0;
padding: 0;
}
.nav-menu .dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
}
.nav-menu .dropdown-content a:hover {
background-color: #ff0000;
color: #fff;
}
.nav-menu .dropdown:hover .dropdown-content {
display: block;
}
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css">
<!-- just for the example -->
<div class="nav-menu">
<img src="img/logo.jpg" style="width:50px">
<ul>
<li class="dropdown">
Games
<ul class="dropdown-content">
<li>Link 1</li>
<li>Link 2</li>
<li>Link 3</li>
</ul>
</li>
<li class="dropdown">
Crews
<ul class="dropdown-content">
<li>Link 1</li>
<li>Link 2</li>
<li>Link 3</li>
</ul>
</li>
<li>Jobs</li>
<li>Photos</li>
<li>Videos</li>
<li>Events</li>
<li>News</li>
</ul>
<ul class="social">
<li>Sign In</li>
<li>Sign Up</li>
<li><i class="fas fa-search"></i></li>
</ul>
</div>
You can see the full effect if you view the snippet in full screen.

How to make dropdown content get over content?

I can't see the contents in dropdown because another content is over them (i have iframe down and it covers the data of dropdown contents), i've tried to change the z-index to bigger values and set the position to relative but none of them works, the data in dropdowns are taken from another file:
#Menu-bar ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color:black;
opacity: 0.7;
filter:alpha (opacity=70);
}
li {
float: left;
border-right: 1px solid #bbb;
}
li a,
.dropbtn {
display: inline-block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
li.dropdown {
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
z-index: 200;
}
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
z-index: 200;
}
.dropdown-content a:hover {
background-color: #f1f1f1
}
#dropdownFollowing:hover .dropdown-content {
display: block;
}
<div id="Menu-bar">
<ul>
<li>
<a class="active" href="MainPage.php">
<img src="images/comp4.png" alt="">BIO
</a>
</li>
<li>
<a class="active" id="report-print"></a>
</li>
<li id="dropdownFollowing">
<a class="dropbtn"></a>
<div class="dropdown-content" id="contentFollow"></div>
</li>
<li id="dropdownFollowing">
<a class="dropbtn"></a>
<div class="dropdown-content" id="contentMessages"></div>
</li>
<li id="dropdownFollowing">
<a class="dropbtn" id="notf"></a>
<div class="dropdown-content" id="contentNotifications"></div>
</li>
<li style="float: right">
<img src="images/logout.png" alt="">
</li>
</ul>
</div>
Im not sure exactly what you are trying to do,
but to me it seems you cant see the content of the dropdowns because there is no content in them.
https://jsfiddle.net/0jjdzhm9/
<div id="Menu-bar">
<ul>
<li>
<a class="active" href="MainPage.php">
<img src="images/comp4.png" alt="">BIO
</a>
</li>
<li>
<a class="active" id="report-print"></a>
</li>
<li class="dropdownFollowing">
<a class="dropbtn">test</a>
<div class="dropdown-content" id="contentFollow">test</div>
</li>
<li class="dropdownFollowing">
<a class="dropbtn">test</a>
<div class="dropdown-content" id="contentMessages">test</div>
</li>
<li class="dropdownFollowing">
<a class="dropbtn" id="notf">Test</a>
<div class="dropdown-content" id="contentNotifications">Test</div>
</li>
<li style="float: right">
<img src="images/logout.png" alt="">
</li>
</ul>
</div>
#Menu-bar ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color:black;
opacity: 0.7;
filter:alpha (opacity=70);
}
li {
float: left;
border-right: 1px solid #bbb;
}
li a,
.dropbtn {
display: inline-block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
li.dropdown {
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
z-index: 200;
}
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
z-index: 200;
}
.dropdown-content a:hover {
background-color: #f1f1f1
}
.dropdownFollowing:hover .dropdown-content {
display: block;
}
also changed the #dropdownFollowing selector to a class (.dropdownFollowing:hover) as you have more than one using it.

div hover is not staying steady ,want to create navigation hover like paytm website

The hover div of items should stay stable but it doesn't, when I move cursor from hover a tag it goes away
#ul1 {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: black;
width: 100px;
}
li {
width: 100px;
display: block;
}
li a,
.dropbtn {
display: block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
li a:hover,
.dropdown:hover .dropbtn {
background-color: orange;
}
li.dropdown {
display: block;
}
li.dropdown2 {
display: block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: green;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
}
.dropdown-content2 {
display: none;
position: absolute;
background-color: green;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
}
.dropdown-content a {
color: white;
padding: 20px 20px;
text-decoration: none;
display: block;
text-align: center;
}
.dropdown-content2 a {
position: relative;
top: 100px;
left: 500px;
color: white;
background-color: red;
padding: 20px 20px;
text-decoration: none;
display: block;
text-align: center;
}
.dropdown-content a:hover {
background-color: pink;
}
dropdown-content2 a:hover {
background-color: pink;
}
.dropdown:hover .dropdown-content {
display: block;
}
.dropdown2:hover .dropdown-content2 {
display: block;
}
<ul id="ul1">
<li> Home </li>
<li> Services </li>
<li class="dropdown">
Products
<div class="dropdown-content">
<ul id="ul2">
<li class="dropdown2"> Mobiles
<div class="dropdown-content2">
Mobile1
Mobile2
Mobile3
Mobile4
Mobile5
</div>
</li>
<li> Televisions </li>
<li> Microwave </li>
<li> Clothing </li>
<li> Footware </li>
</ul>
</div>
</li>
</ul>
I have tried many things to deal with this like scaling padding to max or increasing width and height but nothing works.
The div goes away as soon as I move my cursor for hovered item
I removed position:absolute from the dropdown <a> tags and fixed the positioning of each dropdown level. This resolves the positioning of submenus in relation to the parent menu.
The hover mechanism works well with the arrangement of the menus. When you hover out, the menus disappear, which is standard behavior for drop-down menus. If you wish to leave the menu visible on hover out, you will need to define a javascript function that controls menu visibility, for instance, hiding when clicking on a menu item.
#ul1 {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: black;
width: 160px;
}
li {
width: 160px;
display: block;
}
li a,
.dropbtn {
display: block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
li a:hover,
.dropdown:hover .dropbtn {
background-color: orange;
}
li.dropdown {
display: block;
}
li.dropdown2 {
display: block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: green;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
left:166px;
margin-top:-46px;
}
.dropdown-content2 {
display: none;
position: absolute;
background-color: green;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
left:160px;
margin-top:-46px;
}
.dropdown-content a {
color: white;
/*padding: 20px 20px;*/
text-decoration: none;
display: block;
text-align: center;
}
.dropdown-content2 a {
color: white;
background-color: red;
/*padding: 20px 20px;*/
text-decoration: none;
display: block;
text-align: center;
}
.dropdown-content a:hover {
background-color: pink;
}
dropdown-content2 a:hover {
background-color: pink;
}
.dropdown:hover .dropdown-content {
display: block;
}
.dropdown2:hover .dropdown-content2 {
display: block;
}
#ul2 {padding:0px;}
<ul id="ul1">
<li> Home </li>
<li> Services </li>
<li class="dropdown">
Products
<div class="dropdown-content">
<ul id="ul2">
<li class="dropdown2" style="position:relative;"> Mobiles
<div class="dropdown-content2">
Mobile1
Mobile2
Mobile3
Mobile4
Mobile5
</div>
</li>
<li> Televisions </li>
<li> Microwave </li>
<li> Clothing </li>
<li> Footware </li>
</ul>
</div>
</li>
</ul>

Dropdown Menu Not Working?

I've searched through this code for errors that would keep it from working, but can't seem to find any. All appears well, except the menu will not dropdown. Does anyone have any tips?
Here is my code as snippet:
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #5BC8C3;
position: fixed;
top: 60px;
width: 100%;
}
li {
float: left;
}
li a,
.dropbtn {
display: inline-block;
color: #f7f7f7;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
li a:hover,
.dropdown:hover .dropbtn {
background-color: #F7f7f7;
}
li.dropdown {
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #284A64;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
}
.dropdown-content a {
color: #f7f7f7;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
}
.dropdown-content a:hover {
background-color: #f7f7f7
}
.dropdown:hover .dropdown-content {
display: block;
}
<ul>
<li><a class="active" href="#index">Home</a>
</li>
<li>Catalog
</li>
<li>Calendar
</li>
<li class="dropdown">
Library Information
<div class="dropdown-content">
Children's Programs
Adult Programs
Help Services
Other Services
Library Policies
</div>
</li>
<li>Contact
</li>
</ul>
Thank you for any advice!
Well, the dropdown-menu actually shows up :)
But we cannot see it, because your menu is
overflow: hidden;
If you delete this css-row, your menu will work:
ul {
list-style-type: none;
margin: 0;
padding: 0;
background-color: #5BC8C3;
position: fixed;
top: 60px;
width: 100%;
}
li {
float: left;
}
li a,
.dropbtn {
display: inline-block;
color: #f7f7f7;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
li a:hover,
.dropdown:hover .dropbtn {
background-color: #F7f7f7;
}
li.dropdown {
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #284A64;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
}
.dropdown-content a {
color: #f7f7f7;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
}
.dropdown-content a:hover {
background-color: #f7f7f7
}
.dropdown:hover .dropdown-content {
display: block;
}
<ul>
<li><a class="active" href="#index">Home</a>
</li>
<li>Catalog
</li>
<li>Calendar
</li>
<li class="dropdown">
Library Information
<div class="dropdown-content">
Children's Programs
Adult Programs
Help Services
Other Services
Library Policies
</div>
</li>
<li>Contact
</li>
</ul>
ul{
margin:0px;
padding:0px;
list-style:none;
}
ul li{
background-color:#5BC8C3;
width:150px;
height:50px;
float:left;
line-height:50px;
color:#0FC;
text-align:center;
}
ul li a{
color: #FFF;
text-decoration:none;
display:block;
}
ul li a:hover{
background-color:#F7f7f7;
}
<ul>
<li>Home</li>
<li>Catalog</li>
<li>Calender</li>
<li>Library Information
<ul>
<li>Children's Programs</li>
<li>Adult Programs</li>
<li>Help Services</li>
</ul>
</li>
<li>Contact</li>
</ul>

CSS Dropdown Menu with arrow

I am trying to create a drop-down menu that should have 2 levels of dropdown. I want the a menu item (Product), when I hover over its sub-menu(Our Brands) it should come with an arrow and drop-down to side.
Demo :- https://jsfiddle.net/nnefhpxf/
HTML
<div id="navbar-collapse-grid" class="navbar-collapse collapse">
<ul class="nav navbar-nav" id = "drop-nav">
<li><a class="active" href="index.html">Home</a></li>
<li class="dropdown">
Our Company
<div class="dropdown-content">
Company Overview
Management
Manufacturing
Business
</div>
</li>
<li class="dropdown">
Product
<div class="dropdown-content">
Our Brand
<ul>
<li>Intes-o</li>
<li>Frig-M</li>
<li>Rahat</li>
<li>Zesund</li>
<li>Bioti 1gm I.V</li>
<li>Vomiss I.V</li>
</ul>
New Brand Releases
</div>
</li>
<li>Mission</li>
<li>Vision</li>
<li>Contact Us</li>
</ul>
</div>
css
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: gray;
font-size: 17px;
}
li {
float: left;
}
li a,
.dropbtn {
display: inline-block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
li a:hover,
.dropdown:hover .dropbtn {
background-color: #75c5cf;
}
li.dropdown {
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgb3a(0, 0, 0, 0.2);
}
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
}
.dropdown-content a:hover {
background-color: #f1f1f1
}
.dropdown:hover .dropdown-content {
display: block;
}
Try this. The hover arrow on the brand item I have uploaded from the local. Please check the below code.
/* css */
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: gray;
font-size: 17px;
}
li {
float: left;
}
li a,
.dropbtn {
display: inline-block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
li a:hover,
.dropdown:hover .dropbtn {
background-color: #75c5cf;
}
li.dropdown {
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
}
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
}
.dropdown-content a:hover {
background-color: #f1f1f1
}
.dropdown:hover .dropdown-content {
display: block;
}
.sub-mnu {
position: absolute;
left: 174px;
top: 0px;
}
.dropdown-content ul {
display: none;
}
.dropdown-content:hover ul {
display: block;
}
.brnd {
background-image: url(https://www.dropbox.com/s/fhjnwgbokn8i8eo/arrow.png);
background-position: right;
background-repeat: no-repeat;
}
<div id="navbar-collapse-grid" class="navbar-collapse collapse">
<ul class="nav navbar-nav" id="drop-nav">
<li><a class="active" href="index.html">Home</a>
</li>
<li class="dropdown">
Our Company
<div class="dropdown-content">
Company Overview
Management
Manufacturing
Business
</div>
</li>
<li class="dropdown">
Product
<div class="dropdown-content">
Our Brand
<ul class="sub-mnu">
<li>Intes-o
</li>
<li>Frig-M
</li>
<li>Rahat
</li>
<li>Zesund
</li>
<li>Bioti 1gm I.V
</li>
<li>Vomiss I.V
</li>
Zesund
</ul>
New Brand Releases
</div>
</li>
<li>Mission
</li>
<li>Vision
</li>
<li>Contact Us
</li>
</ul>
</div>