Hover not working on navigation menu text











up vote
0
down vote

favorite












I have a navigation bar with 5 items. Hover only works when mouse moves over the whole item, but doesn't work when on the items' text. It happened after I changed the size of navigation bar. Here is my CSS code.






ul {
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
list-style-type: none;
margin: 0;
padding: 0;
height: 40px;
overflow: hidden;
background-color: #212121;
}

li {
float: left;
height: 40px;
}

li a,
.dropbtn {
display: inline-block;
color: white;
text-align: center;
padding: 12px 16px;
text-decoration: none;
}

li a:hover,
.dropdown:hover .dropbtn {
background-color: red;
}

.dropdown-content a:hover {
background-color: #00ccff;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
}

.dropdown:hover .dropdown-content {
display: block;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
}

<div id="oes_navigationbar">
<ul>
<li><a href="../index.html">Home</a></li>
<li><a class="selected" href="../Views/loginpage.jsp">Login</a></li>
<li><a href="../Views/about.jsp">About</a></li>
<li class="dropdown"><a href="#" class="dropbtn">Sign Up</a>
<div class="dropdown-content"><a href="../Student/registrationpage.jsp">As Student</a><a href="../faculty/facultyregistration.jsp">As Faculty</a></div>
</li>
<li><a href="../Views/contactpage.jsp" target="_blank">Contact</a></li>
<li><a href="../Views/help.jsp" target="_blank">Help</a></li>
</ul>
<div class="cleaner"></div>
</div>












share|improve this question




















  • 2




    where is your html? provide a working example (not just code blocks).
    – Dekel
    Nov 19 at 14:24










  • I don't see any dropdown in your example
    – Dekel
    Nov 19 at 14:34










  • ul {overflow: hidden;} hides the dropdown
    – Simsteve7
    Nov 19 at 14:35










  • Can you describe the problem more? If I remove the overflow of ul, the dropdown works ok. Also add ul:after {clear: both; content: ''; display: block;} and remove height of li and ul, move it to the a.
    – Simsteve7
    Nov 19 at 14:40










  • dropdown used only for display: inline-block
    – Dev Sharma
    Nov 19 at 14:46















up vote
0
down vote

favorite












I have a navigation bar with 5 items. Hover only works when mouse moves over the whole item, but doesn't work when on the items' text. It happened after I changed the size of navigation bar. Here is my CSS code.






ul {
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
list-style-type: none;
margin: 0;
padding: 0;
height: 40px;
overflow: hidden;
background-color: #212121;
}

li {
float: left;
height: 40px;
}

li a,
.dropbtn {
display: inline-block;
color: white;
text-align: center;
padding: 12px 16px;
text-decoration: none;
}

li a:hover,
.dropdown:hover .dropbtn {
background-color: red;
}

.dropdown-content a:hover {
background-color: #00ccff;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
}

.dropdown:hover .dropdown-content {
display: block;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
}

<div id="oes_navigationbar">
<ul>
<li><a href="../index.html">Home</a></li>
<li><a class="selected" href="../Views/loginpage.jsp">Login</a></li>
<li><a href="../Views/about.jsp">About</a></li>
<li class="dropdown"><a href="#" class="dropbtn">Sign Up</a>
<div class="dropdown-content"><a href="../Student/registrationpage.jsp">As Student</a><a href="../faculty/facultyregistration.jsp">As Faculty</a></div>
</li>
<li><a href="../Views/contactpage.jsp" target="_blank">Contact</a></li>
<li><a href="../Views/help.jsp" target="_blank">Help</a></li>
</ul>
<div class="cleaner"></div>
</div>












share|improve this question




















  • 2




    where is your html? provide a working example (not just code blocks).
    – Dekel
    Nov 19 at 14:24










  • I don't see any dropdown in your example
    – Dekel
    Nov 19 at 14:34










  • ul {overflow: hidden;} hides the dropdown
    – Simsteve7
    Nov 19 at 14:35










  • Can you describe the problem more? If I remove the overflow of ul, the dropdown works ok. Also add ul:after {clear: both; content: ''; display: block;} and remove height of li and ul, move it to the a.
    – Simsteve7
    Nov 19 at 14:40










  • dropdown used only for display: inline-block
    – Dev Sharma
    Nov 19 at 14:46













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I have a navigation bar with 5 items. Hover only works when mouse moves over the whole item, but doesn't work when on the items' text. It happened after I changed the size of navigation bar. Here is my CSS code.






ul {
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
list-style-type: none;
margin: 0;
padding: 0;
height: 40px;
overflow: hidden;
background-color: #212121;
}

li {
float: left;
height: 40px;
}

li a,
.dropbtn {
display: inline-block;
color: white;
text-align: center;
padding: 12px 16px;
text-decoration: none;
}

li a:hover,
.dropdown:hover .dropbtn {
background-color: red;
}

.dropdown-content a:hover {
background-color: #00ccff;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
}

.dropdown:hover .dropdown-content {
display: block;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
}

<div id="oes_navigationbar">
<ul>
<li><a href="../index.html">Home</a></li>
<li><a class="selected" href="../Views/loginpage.jsp">Login</a></li>
<li><a href="../Views/about.jsp">About</a></li>
<li class="dropdown"><a href="#" class="dropbtn">Sign Up</a>
<div class="dropdown-content"><a href="../Student/registrationpage.jsp">As Student</a><a href="../faculty/facultyregistration.jsp">As Faculty</a></div>
</li>
<li><a href="../Views/contactpage.jsp" target="_blank">Contact</a></li>
<li><a href="../Views/help.jsp" target="_blank">Help</a></li>
</ul>
<div class="cleaner"></div>
</div>












share|improve this question















I have a navigation bar with 5 items. Hover only works when mouse moves over the whole item, but doesn't work when on the items' text. It happened after I changed the size of navigation bar. Here is my CSS code.






ul {
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
list-style-type: none;
margin: 0;
padding: 0;
height: 40px;
overflow: hidden;
background-color: #212121;
}

li {
float: left;
height: 40px;
}

li a,
.dropbtn {
display: inline-block;
color: white;
text-align: center;
padding: 12px 16px;
text-decoration: none;
}

li a:hover,
.dropdown:hover .dropbtn {
background-color: red;
}

.dropdown-content a:hover {
background-color: #00ccff;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
}

.dropdown:hover .dropdown-content {
display: block;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
}

<div id="oes_navigationbar">
<ul>
<li><a href="../index.html">Home</a></li>
<li><a class="selected" href="../Views/loginpage.jsp">Login</a></li>
<li><a href="../Views/about.jsp">About</a></li>
<li class="dropdown"><a href="#" class="dropbtn">Sign Up</a>
<div class="dropdown-content"><a href="../Student/registrationpage.jsp">As Student</a><a href="../faculty/facultyregistration.jsp">As Faculty</a></div>
</li>
<li><a href="../Views/contactpage.jsp" target="_blank">Contact</a></li>
<li><a href="../Views/help.jsp" target="_blank">Help</a></li>
</ul>
<div class="cleaner"></div>
</div>








ul {
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
list-style-type: none;
margin: 0;
padding: 0;
height: 40px;
overflow: hidden;
background-color: #212121;
}

li {
float: left;
height: 40px;
}

li a,
.dropbtn {
display: inline-block;
color: white;
text-align: center;
padding: 12px 16px;
text-decoration: none;
}

li a:hover,
.dropdown:hover .dropbtn {
background-color: red;
}

.dropdown-content a:hover {
background-color: #00ccff;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
}

.dropdown:hover .dropdown-content {
display: block;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
}

<div id="oes_navigationbar">
<ul>
<li><a href="../index.html">Home</a></li>
<li><a class="selected" href="../Views/loginpage.jsp">Login</a></li>
<li><a href="../Views/about.jsp">About</a></li>
<li class="dropdown"><a href="#" class="dropbtn">Sign Up</a>
<div class="dropdown-content"><a href="../Student/registrationpage.jsp">As Student</a><a href="../faculty/facultyregistration.jsp">As Faculty</a></div>
</li>
<li><a href="../Views/contactpage.jsp" target="_blank">Contact</a></li>
<li><a href="../Views/help.jsp" target="_blank">Help</a></li>
</ul>
<div class="cleaner"></div>
</div>





ul {
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
list-style-type: none;
margin: 0;
padding: 0;
height: 40px;
overflow: hidden;
background-color: #212121;
}

li {
float: left;
height: 40px;
}

li a,
.dropbtn {
display: inline-block;
color: white;
text-align: center;
padding: 12px 16px;
text-decoration: none;
}

li a:hover,
.dropdown:hover .dropbtn {
background-color: red;
}

.dropdown-content a:hover {
background-color: #00ccff;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
}

.dropdown:hover .dropdown-content {
display: block;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
}

<div id="oes_navigationbar">
<ul>
<li><a href="../index.html">Home</a></li>
<li><a class="selected" href="../Views/loginpage.jsp">Login</a></li>
<li><a href="../Views/about.jsp">About</a></li>
<li class="dropdown"><a href="#" class="dropbtn">Sign Up</a>
<div class="dropdown-content"><a href="../Student/registrationpage.jsp">As Student</a><a href="../faculty/facultyregistration.jsp">As Faculty</a></div>
</li>
<li><a href="../Views/contactpage.jsp" target="_blank">Contact</a></li>
<li><a href="../Views/help.jsp" target="_blank">Help</a></li>
</ul>
<div class="cleaner"></div>
</div>






html css hover navigationbar onhover






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 19 at 14:30









Pugazh

8,04841942




8,04841942










asked Nov 19 at 14:23









Dev Sharma

269




269








  • 2




    where is your html? provide a working example (not just code blocks).
    – Dekel
    Nov 19 at 14:24










  • I don't see any dropdown in your example
    – Dekel
    Nov 19 at 14:34










  • ul {overflow: hidden;} hides the dropdown
    – Simsteve7
    Nov 19 at 14:35










  • Can you describe the problem more? If I remove the overflow of ul, the dropdown works ok. Also add ul:after {clear: both; content: ''; display: block;} and remove height of li and ul, move it to the a.
    – Simsteve7
    Nov 19 at 14:40










  • dropdown used only for display: inline-block
    – Dev Sharma
    Nov 19 at 14:46














  • 2




    where is your html? provide a working example (not just code blocks).
    – Dekel
    Nov 19 at 14:24










  • I don't see any dropdown in your example
    – Dekel
    Nov 19 at 14:34










  • ul {overflow: hidden;} hides the dropdown
    – Simsteve7
    Nov 19 at 14:35










  • Can you describe the problem more? If I remove the overflow of ul, the dropdown works ok. Also add ul:after {clear: both; content: ''; display: block;} and remove height of li and ul, move it to the a.
    – Simsteve7
    Nov 19 at 14:40










  • dropdown used only for display: inline-block
    – Dev Sharma
    Nov 19 at 14:46








2




2




where is your html? provide a working example (not just code blocks).
– Dekel
Nov 19 at 14:24




where is your html? provide a working example (not just code blocks).
– Dekel
Nov 19 at 14:24












I don't see any dropdown in your example
– Dekel
Nov 19 at 14:34




I don't see any dropdown in your example
– Dekel
Nov 19 at 14:34












ul {overflow: hidden;} hides the dropdown
– Simsteve7
Nov 19 at 14:35




ul {overflow: hidden;} hides the dropdown
– Simsteve7
Nov 19 at 14:35












Can you describe the problem more? If I remove the overflow of ul, the dropdown works ok. Also add ul:after {clear: both; content: ''; display: block;} and remove height of li and ul, move it to the a.
– Simsteve7
Nov 19 at 14:40




Can you describe the problem more? If I remove the overflow of ul, the dropdown works ok. Also add ul:after {clear: both; content: ''; display: block;} and remove height of li and ul, move it to the a.
– Simsteve7
Nov 19 at 14:40












dropdown used only for display: inline-block
– Dev Sharma
Nov 19 at 14:46




dropdown used only for display: inline-block
– Dev Sharma
Nov 19 at 14:46

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53376663%2fhover-not-working-on-navigation-menu-text%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53376663%2fhover-not-working-on-navigation-menu-text%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Wiesbaden

Marschland

Dieringhausen