Menu impossible to click on in IE - html

I have some code that creates a list that when hovered on, drops down to reveal a sub menu. the problem is is that it doesn't work in IE. When the link is hovered over in IE, it doesn't drop the menu down but it pushes it over to the right, making it impossible to click on.
This code works perfect in FF and Chrome and the website I got the code from said that it should work in IE.
I'm fairly new at coding as I tend to copy and paste chunks of code and learn little bits so figuring something like this out on my own is way too difficult.
Any help would be greatly appreciated :)
CSS:
#dropmenu,
#dropmenu ul {
list-style: none;
}
#dropmenu {
float: left;
width: auto;
}
#dropmenu li {
width: auto;
}
#dropmenu > li {
float: left;
width: auto;
}
#dropmenu li a {
display: block;
height: 2em;
line-height: 2em;
padding: 0 1.5em;
text-decoration: none;
}
#dropmenu ul {
position: absolute;
display: none;
z-index: 999;
}
#dropmenu ul li a {
width: 80px;
}
#dropmenu li:hover ul {
display: block;
}
/* Main menu
------------------------------------------*/
#dropmenu {
font-family: Arial;
font-size: 16px;
background: #;
}
#dropmenu > li > a {
color: #000;
font-weight: normal;
}
#dropmenu > li:hover > a {
background: #;
color: #000;
}
/* Submenu
------------------------------------------*/
#dropmenu ul {
background: #;
}
#dropmenu ul li a {
color: #000;
}
#dropmenu ul li:hover a {
background: #f16b20;
}
#dropmenu ul li:hover a {
color: white;
}
HTML:
<ul id="dropmenu">
<li>Our Company
<ul>
<li>Hellenico</li>
<li>Genere</li>
<li>Indulgentia</li>
</ul>
</li>
<li>Our Solutions
<ul>
<li>Hellenico</li>
<li>Genere</li>
<li>Indulgentia</li>
</ul>
</li>
<li>Service Desk
<ul>
<li>Hellenico</li>
<li>Genere</li>
<li>Indulgentia</li>
</ul>
</li>
<li>resources
<ul>
<li>Hellenico</li>
<li>Genere</li>
<li>Indulgentia</li>
</ul>
</li>
<li>Contact
<ul>
<li>Hellenico</li>
<li>Genere</li>
<li>Indulgentia</li>
</ul>
</li>
</ul>
JSFiddle EXAMPLE

Just done following changes in your css. DEMO
#dropmenu li {
width: auto;
position:relative; /*newly added*/
}
#dropmenu ul {
position: absolute;
display: none;
z-index: 999;
left:0; /*newly added*/
top:20px; /*newly added*/
}

Add a position:relative; to your #dropmenu li, this can do. also try it with a margin-left: 0; to your #dropmenu li ul
I did the follow and its working for me:
/* added position relative */
#dropmenu li {
position: relative;
float: left;
}
And removed #dropmenu > li
And added the padding, background and margin-left to #dropmenu ul
#dropmenu ul {
position: absolute;
display: none;
z-index: 999;
margin-left: 0;
padding: 0;
background: #fff;
}

Related

CSS: drop down menu doesn't display when navbar is repositioned

I want to reposition my navbar. In its current position:
#navbar ul {
width: 100%;
float: left;
margin: 0;
padding: 0;
list-style: none;
background-color: #5D2C2C;
/*position: relative;
bottom: 115px;*/
}
#navbar ul li {
float: left;
/*position: relative;
left: 420px;*/
}
#navbar li li {
display: none;
}
#navbar li:hover li {
display: block;
width: inherit;
}
#navbar a {
font-family: "Palatino Linotype";
color: #FFF;
text-decoration: none;
padding: 2px 5px;
}
the dropdown displays correctly
but when I remove the /* comments */ so the bar is correctly positioned, the menu drops down but the two items aren't showing and I cannot find out why
the HTML if needed:
<div id="navbar">
<ul>
<li>Introduction</li>
<li>History</li>
<li>National Flags</li>
<li>International Maritime Signal Flags
<ul>
<li>Maritme Signals: Letters</li>
<li>Maritme Signals: Numbers </li>
</ul>
</li>
</ul>

Dropdown links do not display on hover

After a long break from HTML/CSS, I recently created a menu with dropdown links using a method I have used once before, and was surprised to find that this application of them is not working.
I used this
ul li:hover ul{ display:block;}
to "turn on" my menus when hovering, but they simply never appear. I have tried adding div tags around various blocks of code to no avail. What tricks am I missing?
jsfiddle here: https://jsfiddle.net/qccs4mLL/
Your html isn't align with your css selector.
ul.menu li:hover > ul {
display: block;
background: green;
}
There isn't any ul element that is direct child of li element. You can change your html so ul is direct child of li element.
body {
margin: 0px;
}
a {
text-decoration: none;
width: 8em;
/*width of each link*/
}
/*format list*/
ul {
text-align: center;
margin: 0;
padding: 0;
list-style: none;
}
ul.menu {
height: 2.5em;
width: 100%;
padding: 0;
margin: 0;
border: 0;
background-color: #454545;
}
ul.menu li {
float: left;
position: relative;
}
ul.menu li a {
cursor: pointer;
display: block;
color: white;
line-height: 2.5em;
padding: 0 10px;
}
ul.menu ul {
background: #555;
display: none;
position: absolute;
left: 0;
top: 100%;
}
ul.menu li:hover {
background: red;
}
ul.menu li:hover > ul {
display: block;
background: green;
}
<body>
<!--Heading-->
<!--Should change when scrolled down/on mobile-->
<h1 class="heading">Title</h1>
<!--Create Menus-->
<nav>
<ul class="menu">
<li>link1
<ul>
<li>sublink1
</li>
</ul>
</li>
<!--menu options with sub options have dropdown on computer, may unfold with tap on mobile or just be a click since they all go to one page maybe? maybe go with unfolding.-->
<li>link2
<ul>
<li>sublink1
</li>
<li>sublink2
</li>
<li>sublink3
</li>
<li>sublink4
</li>
</ul>
</li>
<li>link3
</li>
<li>link4
</li>
</ul>
</nav>
</body>

Navbar in HTML/CSS not functioning properly

I am new to website design, and there are a few flaws in my navbar that I cannot fix.
I cannot get the navbar to center properly.
When the screen resolution changes, the list overflows into the next line.
there is 1 list element that is sized differently and I cannot seem to figure out why.
Here is the code:
https://jsfiddle.net/b02nm6ae/#update
CSS:
.nav_wrapper {
z-index: 9999;
padding: 0;
margin: 0;
width: 100%;
min-width: 50px;
}
.nav_wrapper ul {
display: block;
position: relative;
position: fixed;
/* fixes automatic values set by ul */
margin: 0;
padding: 0;
}
.nav_wrapper ul li {
list-style: none;
display: list-item;
background-color: #993300;
float: left;
}
/* hides the submenu by default */
.nav_wrapper ul ul {
display: none;
position: absolute;
}
/* makes the sub menu appear on hover over list element */
.nav_wrapper ul li:hover > .sub_nav1 {
display: list-item;
list-style: none;
}
/* lists the list items on top of one another */
.nav_wrapper ul .sub_nav1 li {
float: none;
position: relative;
}
.nav_wrapper ul li a{
display: block;
text-decoration: none;
color: #ffffff;
padding: 12px;
}
.nav_wrapper li a:hover{
color: #000;
background-color: #ffffff;
}
/* Dropdown Menu arrow */
.nav_wrapper ul li > a:after {
content: '\25BE';
}
.nav_wrapper ul li > a:only-child:after {
content: '';
}
HTML:
<body>
<!-- NAV -->
<div class="nav_wrapper">
<ul class="nav">
<li>Home</li>
<li>Calandar</li>
<li>About Us
<ul class="sub_nav1">
<li>The Pastor</li>
<li>History</li>
<li>About Byzantines</li>
</ul>
</li>
<li>Mass Times</li>
<li>Contact Us</li>
</ul>
<div>
<!-- SECTION 1 -->
</body>
</html>
Once you float the li then centering becomes problematical. In these instances, it's often preferred to use display:inline-block and center then by applying text-align:center to the parent ul.
This does have a white-space downside but there are methods around that, one of which (font-size) I have used here.
As for the single element with the greater height...that was caused by the pseudo-element...so slapped a quick patch over it. Frankly, I would be applying a class to the parent li and using a pseudo-element on the li but that's another debate entirely.
body {
font-family: 'Didact Gothic', sans-serif;
padding: 0;
margin: 0;
background-color: #CCCCFF;
}
.nav_wrapper ul {
display: block;
margin: 0;
padding: 0;
text-align: center;
font-size: 0;
/* remove whitespace */
}
.nav_wrapper ul li {
list-style: none;
display: inline-block;
vertical-align: top;
background-color: #993300;
position: relative;
font-size: 1rem;
/* font-size reset */
}
/* hides the submenu by default */
.nav_wrapper ul ul {
display: none;
top: 100%;
left: 0;
position: absolute;
}
/* makes the sub menu appear on hover over list element */
.nav_wrapper ul li:hover > .sub_nav1 {
display: block;
width: 100%;
}
/* lists the list items on top of one another */
.nav_wrapper ul .sub_nav1 li {
position: relative;
width: 100%;
}
.nav_wrapper ul li a {
display: block;
text-decoration: none;
color: #ffffff;
padding: 12px;
}
.nav_wrapper li a:hover {
color: #000;
background-color: #ffffff;
}
/* Dropdown Menu arrow */
.nav_wrapper ul> li > a:after {
content: '\25BE';
line-height: 0;
}
.nav_wrapper ul li > a:only-child:after {
content: '';
}
<div class="nav_wrapper">
<ul class="nav">
<li>Home
</li>
<li>Calendar
</li>
<li>About Us
<ul class="sub_nav1">
<li>The Pastor
</li>
<li>History
</li>
<li>About Byzantines
</li>
</ul>
</li>
<li>Mass Times
</li>
<li>Contact Us
</li>
</ul>
<div>
Well I notice that if I set a 25 pixel height to
.nav_wrapper ul li a
that removes the extra space for example..
.nav_wrapper ul li a{
height:25px;
display: block;
text-decoration: none;
color: #ffffff;
padding: 12px;
}
https://jsfiddle.net/b02nm6ae/9/

CSS menu won't work with internet explorer 11

I found this CSS code for an horizontal dropdown menu over the internet which at first seems really good (the results on chrome are perfect). However, when I try it with internet explorer, white spaces appear between the dropdown elements and I cannot navigate the menu.
Have any idea? Your help would be greatly appreciated.
HTML :
<div id="menu">
<ul>
<li>Accueil</li>
<li>CV</li>
<li>Enseignement
<ul>
<li>Plans de cours</li>
<li>Leçons</li>
<li>Powerpoints </li>
</ul>
</li>
<li>Recherche
<ul>
<li>Italia</li>
<li>Livres</li>
</ul>
</li>
<li>Liens</li>
<li>Contact</li>
<li>English</li>
</ul>
</div>
And the CSS :
ul {
font-family: Arial, Verdana;
font-size: 14px;
margin: 0;
padding: 0;
list-style: none;
}
ul a:hover {
color: #ffffff;
}
ul li {
display: block;
position: relative;
float: left;
}
li ul {
display: none;
}
ul li a {
display: block;
text-decoration: none;
color: #ffffff;
border-top: 0px solid #ffffff;
padding: 5px 15px 5px 15px;
background: #2C5463;
margin-left: 0px;
white-space: nowrap;
}
ul li a:hover {
background: #617F8A;
}
li:hover ul {
display: block;
position: absolute;
}
li:hover li {
float: none;
font-size: 11px;
}
li:hover a {
background: #617F8A;
}
li:hover li a:hover {
background: #95A9B1;
}
Are you missing some code from your examples or is this the exact code, because I think you'r missing the close
</ul>
?

Dropdown CSS and HTML Navigation Menu doesn't work in IE6 - IE8

I have created a CSS and HTML navigation menu that works in all browsers except IE6 - IE8. How can I make this work? I've attempted to make my css and html as small as possible to help with the compatibility but to no avail.
CSS and HTML
ul ul {
display: none;
}
ul li:hover > ul {
display: block;
}
ul {
background-color: #99CCFF;
background-color: rgb(153, 204, 255);
list-style-type: none;
position: relative;
display: inline-table;
font-family: 'Julius Sans One', sans-serif;
}
ul:after {
content: ""; clear: both; display: block;
}
ul li {
float: left;
display:none;
}
ul li:hover {
background: #6699CC;
}
ul li:hover a {
color: #000000;
}
ul li a {
display: block; padding: 25px 40px;
color: #000000; text-decoration: none;
}
ul ul {
background: #99CCFF; padding: 0;
position: absolute; top: 100%;
}
ul ul li {
display:inline;
float: none;
border-top: 0px solid #6b727c;
border-bottom: 0px solid #575f6a;
position: relative;
}
ul ul li a {
padding: 15px 40px;
color: #000000;
}
ul ul li a:hover {
background: #6699CC;
}
ul ul ul {
position: absolute; left: 100%; top:0;
}
<ul id="nav">
<li>Contact Us
<ul>
<li>Address</li>
<li>Rentals</li>
<li>Phone Numbers</li>
</ul>
</li>
<li>Mass
<ul>
<li>Readings</li>
<li>Bulletins</li>
<li>Catechism</li>
<li>Archdiocese of<br>Indiana</li>
<li>Confession</li>
<li>Mass Schedule</li>
</ul>
</li>
<li>Ministries
<ul>
<li>Pre-School</li>
<li>Day Care</li>
<li>CCD</li>
<li>Haiti<br>Ministry</li>
</ul>
</li>
<li>Info
<ul>
<li>Walking<br>Park</li>
<li>Councils &<br>Committees</li>
<li>Cemetery Rules</li>
<li>Bulletins</li>
<li>Catechism</li>
</ul>
<li>Activities
<ul>
<li>Labor Day<br>Festival</li>
<li>Bingo</li>
<li>Drawdown</li>
<li>MSGR Schmitz<br>Memorial Fund</li>
</ul>
</li>
</ul>
Looks like you have too many preceding ul selectors in your css rules.
<ul>
<li>
<ul> </ul>
</li>
<ul>
That is your basic structure. Try removing the extra ul from the css where there are more than 2 of them.
Second, I notice you're using an inline-table rule. Rules like these are often trouble with older versions of IE, so make sure to do a compatibility check on these types of rules. Here's another SO post as a reference to this:
display:inline-table