Drop Down Menu not showing properly in IE - html

I have a navigation bar, which works perfect in Chrome & Mozilla, but does not work properly in IE.
When you hover the mopue on about us tab, the drop down should come, but its coming inline. and also the background position is not correct.
Pls Help
Code :
CSS :
#nav {
width : auto;
height : 25px;
margin : 10px auto;
padding : 5px;
}
#nav ul {
margin : 17px auto;
padding : 0px;
text-align: center;
}
#nav ul li {
display: inline-block;
list-style: none;
}
#nav ul li a {
text-decoration :none;
color: #175587;
font-size: 15px;
width : auto;
padding: 5px 1px 5px 1px;
height: 35px;
box-shadow: 3px 3px 8px gray;
background: url(../images/listback.png);
}
#nav ul li a:hover, #nav ul li a.current {
background: url(../images/hoverback.png);
color: white;
}
#nav li ul {
display: none;
position: absolute;
}
#nav li:hover ul {
display: block;
z-index: 10;
margin: 0px 0px 0px 0px;
background: url(../images/down2.png) no-repeat;
background-position: 13% 5%;
padding: 65px 0px 0px 0px;
}
#nav li ul li {
float: none;
display: block;
}
#nav li ul li a {
width: 155px;
height: auto;
margin: 0px 0px 0px 0px ;
padding: 5px 0px 5px 5px;
float: left;
background : rgba(29, 71, 113, 0.8);
font-size: 15px;
text-align: left;
text-decoration: none;
font-weight: bold;
color: white;
text-transform: uppercase;
outline: none;
box-shadow: none;
-webkit-box-shadow: none;
-moz-box-shadow: none;
display: block;
}
HTML :-
<div id="nav">
<ul>
<li>Home
</li>
<li>About Us
<ul>
<li>Group Profile
</li>
<li>Management Profile
</li>
<li>Milestones
</li>
<li>Vision & Missions
</li>
</ul>
</li>
<li>AGP
</li>
<li>Products
</li>
<li>Infrastructure
</li>
<li>Support
</li>
<li>Culture
</li>
<li>Certification
</li>
<li>Contact Us
</li>
</ul>
</div>
Please Help.

I added float:left and clear both to #nav li ul li (shown below)
#nav li ul li {
float:none;
display:block;
float:left;
clear:both;
}
Here's a demo working in IE -> http://jsfiddle.net/5kWJz/

Related

My drop down menu won't stay open on hover

I am facing a problem whereby my drop down menu will not stay open when I hover my cursor over it. It sometimes stay open for a while and disappears. I have been trying to find solutions but I can't really tell what is the problem. Can anyone help me? I am new to CSS and HTML...
.arrow {
background-image: url(arrow.png);
background-repeat: no-repeat;
background-position: 100px;
}
.menu-area ul {
text-transform: uppercase;
list-style: none;
width: 145px;
margin-left: 10px;
padding: 0px;
position: absolute;
display: block;
box-shadow: 10px 10px 5px rgba(96, 96, 96, 0.8);
}
.menu-area ul ul {
margin-left: 1px;
position: absolute;
display: none;
left: 100%;
top: 0px;
}
.menu-area ul li {
border-bottom: 1px solid white;
background: MediumVioletRed;
position: relative;
display: block;
margin-bottom: 0px;
}
.menu-area ul li a {
font-family: verdana;
font-size: 12px;
font-weight: bold;
text-align: left;
color: white;
text-decoration: none;
padding: 10px 20px;
display: block;
}
.menu-area ul li:hover {
background-color: hotpink;
}
.menu-area ul li:hover>ul {
display: block;
}
<div class="menu-area">
<ul>
<li>Home</li>
<li><a class="arrow" href="#">Soalan</a>
<ul>
<li>Add</li>
<li>Update</li>
<li>Delete</li>
<li>List</li>
<li><a class="arrow" href="#">Topic</a>
<ul>
<li>Add</li>
<li>Update</li>
<li>Delete</li>
<li>List</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
Youre adding margin-left: 1px; on .menu-area ul ul which makes a 1px gap between the main ul and your submenu ul. If you hit that gap (which is pretty hard as its only 1px but still possible) the submenu closes.
Remove the margin so the ul's "touch" each other without gap for a safe transition between menu and submenu (You can add the same spacing as padding so you keep the 1px gap). Apart from this 1px gap everything runs smoothly.
In general i would recommend adding https://github.com/kamens/jQuery-menu-aim tho so the menu doesnt close when trying to reach for the last submenu item (where you most likely move out of the main-ul which makes the menu close instantly).
The hover style is not applied because of that 1px gap to the child elements. You could remove that margin and set a transparent border on the child ul
.arrow {
background-image: url(arrow.png);
background-repeat: no-repeat;
background-position: 100px;
}
.menu-area ul {
text-transform: uppercase;
list-style: none;
width: 145px;
margin-left: 10px;
padding: 0px;
position: absolute;
display: block;
box-shadow: 10px 10px 5px rgba(96, 96, 96, 0.8);
}
.menu-area ul ul {
margin-left: 0;
border-left: 1px solid transparent;
position: absolute;
display: none;
left: 100%;
top: 0px;
}
.menu-area ul li {
border-bottom: 1px solid white;
background: MediumVioletRed;
position: relative;
display: block;
margin-bottom: 0px;
}
.menu-area ul li a {
font-family: verdana;
font-size: 12px;
font-weight: bold;
text-align: left;
color: white;
text-decoration: none;
padding: 10px 20px;
display: block;
}
.menu-area ul li:hover {
background-color: hotpink;
}
.menu-area ul li:hover>ul,
.menu-area ul li>ul:hover {
display: block;
}
<div class="menu-area">
<ul>
<li>Home</li>
<li><a class="arrow" href="#">Soalan</a>
<ul>
<li>Add</li>
<li>Update</li>
<li>Delete</li>
<li>List</li>
<li><a class="arrow" href="#">Topic</a>
<ul>
<li>Add</li>
<li>Update</li>
<li>Delete</li>
<li>List</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>

Navigation Submenu is not coming up

I have created a Navigation menu with sub menu. Can anyone please help me to find out why sub menu is coming as part of main menu?
Navigation have options like: Home, About, My Portfolio...
My Portfolio have menu options: Web Development, Motion...
Issue: Web Development should have sub menu: Bootstrap, CSS but rather it is coming as part of main menu.<div id="Navigation"><ul class="Navigation"><li>Home</li></ul>/div>
body {
background: #c4c7cb;
background-image: -webkit-radial-gradient(cover, #FFF, #D1D1D1);
background-image: -moz-radial-gradient(cover, #e8eaec, #a4a8ae);
background-image: -o-radial-gradient(cover, #e8eaec, #a4a8ae);
background-image: radial-gradient(cover, #e8eaec, #a4a8ae)
}
html {
min-height: 100%;
}
.Navigation {
height: 50px;
padding: 0;
margin: 0;
position: absolute;
}
.Navigation li {
height: auto;
width: 150px;
float: left;
text-align: center;
list-style: none;
font: 12px"Bonveno", "Century Gothic";
padding: 0;
margin: 0;
background-color: #eee;
border: 1px solid #ccc;
box-shadow: 0 1px 0 rgba(255, 255, 255, .9) inset, 0 1px 3px rgba(0, 0, 0, .1);
border-radius: 3px;
margin-left: 10px;
}
.Navigation a {
padding: 13px;
text-decoration: none;
color: #333;
text-shadow: 0 1px #fff;
display: block;
}
.Navigation li ul {
display: none;
height: auto;
margin-left: -11px;
padding: 0;
}
.Navigation li:hover ul {
display: block;
}
.Navigation li:hover,
a:hover {
background: #e8e8e8;
}
<div id="Navigation">
<ul class="Navigation">
<li>Home
</li>
<li>About
</li>
<li>My Portfolio
<ul>
<li>Web Development
<ul>
<li>Bootstrap
</li>
<li>CSS
</li>
</ul>
</li>
<li>Motion Graphics
</li>
<li>Flash Animation
</li>
<li>Logo Design
</li>
<li>Photography
</li>
</ul>
</li>
<li>Services
</li>
<li>Contact
</li>
</ul>
</div>
It is because you have a CSS rule for .Navigation li:hover ul { display: block; } that I believe you want to show the second level menu on first level item hover. But this rule is also applying to the third level menu (that means all ul under the first level item hovers are applied display: block;), you may want to use
.Navigation li:hover > ul instead
Try this...
body {
background: #c4c7cb;
background-image: -webkit-radial-gradient(cover, #FFF, #D1D1D1);
background-image: -moz-radial-gradient(cover, #e8eaec, #a4a8ae);
background-image: -o-radial-gradient(cover, #e8eaec, #a4a8ae);
background-image: radial-gradient(cover, #e8eaec, #a4a8ae)
}
html {
min-height: 100%;
}
.Navigation {
height: 50px;
padding: 0;
margin: 0;
position: absolute;
}
.Navigation li {
height: auto;
width: 150px;
float: left;
text-align: center;
list-style: none;
font: 12px"Bonveno", "Century Gothic";
padding: 0;
margin: 0;
background-color: #eee;
border: 1px solid #ccc;
box-shadow: 0 1px 0 rgba(255, 255, 255, .9) inset, 0 1px 3px rgba(0, 0, 0, .1);
border-radius: 3px;
margin-left: 10px;
}
.Navigation a {
padding: 13px;
text-decoration: none;
color: #333;
text-shadow: 0 1px #fff;
display: block;
}
.Navigation li ul {
display: none;
height: auto;
margin-left: -11px;
padding: 0;
}
.Navigation li ul li ul {
display: none !important;
height: auto;
margin-left: -11px;
padding: 0;
}
.Navigation li:hover ul {
display: block;
}
.Navigation li ul li:hover ul {
display: block !important;
}
.Navigation li:hover,
a:hover {
background: #e8e8e8;
}
<div id="Navigation">
<ul class="Navigation">
<li>Home
</li>
<li>About
</li>
<li>My Portfolio
<ul>
<li>Web Development
<ul>
<li>Bootstrap
</li>
<li>CSS
</li>
</ul>
</li>
<li>Motion Graphics
</li>
<li>Flash Animation
</li>
<li>Logo Design
</li>
<li>Photography
</li>
</ul>
</li>
<li>Services
</li>
<li>Contact
</li>
</ul>
</div>
body {
background: #c4c7cb;
background-image: -webkit-radial-gradient(cover, #FFF, #D1D1D1);
background-image: -moz-radial-gradient(cover, #e8eaec, #a4a8ae);
background-image: -o-radial-gradient(cover, #e8eaec, #a4a8ae);
background-image: radial-gradient(cover, #e8eaec, #a4a8ae)
}
html {
min-height: 100%;
}
.Navigation {
height: 50px;
padding: 0;
margin: 0;
position: relative;
}
.Navigation li {
height: auto;
width: 150px;
float: left;
text-align: center;
list-style: none;
font: 12px"Bonveno", "Century Gothic";
padding: 0;
margin: 0;
background-color: #eee;
border: 1px solid #ccc;
box-shadow: 0 1px 0 rgba(255, 255, 255, .9) inset, 0 1px 3px rgba(0, 0, 0, .1);
border-radius: 3px;
margin-left: 10px;
}
.Navigation a {
padding: 13px;
text-decoration: none;
color: #333;
text-shadow: 0 1px #fff;
display: block;
}
.Navigation li ul {
display: none;
height: auto;
margin-left: -11px;
padding: 0;
position: absolute;
}
.Navigation li ul li ul {
display: none !important;
height: auto;
margin-left: -11px;
padding: 0;
}
.Navigation li:hover ul {
display: block;
}
.Navigation li ul li:hover ul {
display: block !important;
}
.Navigation li:hover,
a:hover {
background: #e8e8e8;
}
<div id="Navigation">
<ul class="Navigation">
<li>Home
</li>
<li>About
</li>
<li>My Portfolio
<ul>
<li>Web Development
<ul>
<li>Bootstrap
</li>
<li>CSS
</li>
</ul>
</li>
<li>Motion Graphics
</li>
<li>Flash Animation
</li>
<li>Logo Design
</li>
<li>Photography
</li>
</ul>
</li>
<li>Services
</li>
<li>Contact
</li>
</ul>
</div>
You'll just need to adjust your on-hover state rules so that they apply to elements you need to when you need it to.
.Navigation li:hover > ul {
display: block;
}
.Navigation li > ul li:hover > ul {
display: block;
}
See snippet below (note: I've reduced menu item widths slightly to fit them into the preview pane)
.Navigation li > ul li > ul {
position: absolute;
top: 0px;
left: 127px;
}
.Navigation li > ul li > ul li {
float: none;
}
.Navigation li > ul li {
position: relative;
}
body{
background: #c4c7cb;
background-image: -webkit-radial-gradient(cover, #FFF,#D1D1D1 );
background-image: -moz-radial-gradient(cover, #e8eaec, #a4a8ae);
background-image: -o-radial-gradient(cover, #e8eaec, #a4a8ae);
background-image: radial-gradient(cover, #e8eaec, #a4a8ae)
}
html{
min-height:100%;
}
.Navigation{
height: 50px;
padding: 0;
margin: 0;
position: absolute;
}
.Navigation > li:first-child {
margin: 0px;
}
.Navigation li {
height: auto;
width: 115px;
float: left;
text-align: center;
list-style: none;
font:12px "Bonveno", "Century Gothic";
padding: 0;
margin: 0;
background-color: #eee;
border: 1px solid #ccc;
box-shadow: 0 1px 0 rgba(255,255,255, .9) inset, 0 1px 3px rgba(0,0,0, .1);
border-radius: 3px;
margin-left:10px;
}
.Navigation a{
padding:13px;
text-decoration: none;
color:#333;
text-shadow: 0 1px #fff;
display: block;
}
.Navigation li ul{
display: none;
height: auto;
margin-left: -11px;
padding: 0;
}
.Navigation li:hover > ul {
display: block;
}
.Navigation li > ul li:hover > ul {
display: block;
}
.Navigation li:hover, a:hover {
background: #e8e8e8;
}
<div id="Navigation">
<ul class="Navigation">
<li>Home</li>
<li>About</li>
<li>My Portfolio
<ul>
<li>Web Development
<ul>
<li>Bootstrap</li>
<li>CSS</li>
</ul>
</li>
<li>Motion Graphics</li>
<li>Flash Animation</li>
<li>Logo Design</li>
<li>Photography</li>
</ul>
</li>
<li>Services</li>
<li>Contact</li>
</ul>
</div>
From here, you can simply add further styles (if necessary) to sub-menu items 2 levels, or deeper, to appear to the right of the parent menu item (rather than below).
Align sub-menu to right:
The rules below serve only to demonstrate how to get you there. I'd recommend refining them.
.Navigation li > ul li > ul {
position: absolute;
top: 0px;
left: 127px;
}
.Navigation li > ul li > ul li {
float: none;
}
.Navigation li > ul li {
position: relative;
}

Vertical <ul> drop down from horizontal <ul>

I'm trying to create a basic drop-down menu. Whenever I however over "blog", the "wiki" link seems to get dragged into it.
Here's a screenshot to show what I mean:
As you can see, "wiki" is below "march". I want to have "march" drop down from "blog" and keep "wiki" along the green line.
#header {
box-shadow: 0px 0px 5px 2px #000;
border-radius: 15px 15px 15px 15px;
width: 790px;
height: 30px;
line-height: 85%;
background: #002929;
word-spacing: 5px;
}
#header li {
display: inline;
}
#header ul ul {
display: none;
}
#header ul li:hover > ul {
display: block;
}
#header a:hover {
background: #0147FA;
border-radius: 15px 15px 15px 15px;
padding: 2px;
}
#header a {
text-decoration: none;
color: #ffff4c;
}
<div id="header">
<ul>
<li style="font-size:30px"><strong>Home</strong></li>
<li style="font-size:30px"><strong>Blog</strong>
<ul>
<li style="font-size:30px"><strong>March</strong></li>
</ul>
</li>
<li style="font-size:30px"><strong>Wiki</strong></li>
</ul>
</div>
Here's a JSFiddle.
So I cleaned up the css and it seems to work now.
Here is your html below
<div id="header">
<ul>
<li style="font-size:30px"><strong>Home</strong></li>
<li style="font-size:30px"><strong>Blog</strong>
<ul>
<li style="font-size:30px"><strong>March</strong></li>
</ul>
</li>
<li style="font-size:30px"><strong>Wiki</strong></li>
</ul>
</div>
Here is the new css below:
#header {
box-shadow: 0px 0px 5px 2px #000;
border-radius:15px 15px 15px 15px;
width: 790px;
height: 30px;
line-height: 85%;
background: #002929;
word-spacing: 5px;
}
#header li {
display: inline;
}
#header a:hover {
background: #0147FA;
border-radius: 15px 15px 15px 15px;
}
#header a {
text-decoration: none;
color: #ffff4c;
}
#header ul a
{
text-decoration:none;
font-weight:700;
line-height:32px;
padding:0 15px;
}
#header ul li
{
position:relative;
float:left;
margin:0;
padding:0
}
#header ul ul
{
display:none;
position:absolute;
top:100%;
left:0;
padding:0
}
#header ul li:hover > ul
{
display:block
}
Be sure to compare to see the differences between your css and my css. If this is is not what you wanted please get back to me.

Multilevel dropdown menu won't go to the right

I have ran into a slight problem with my dropdown menu. I need and extra level in my dropdown, but i really don't know what to do with the CSS...
The page can be seen here.
The problem can be seen in the menu under "Om os", where "Brochure 2013", "Brochure 2014" should be visible when hovering over "Brochure" and not as it is now!
How to fix this?
Here's my CSS:
.cssmenu {
border: 0px solid #2E181A;
margin: 0px auto 0px auto;
padding: 0px;
font-family: verdana,geneva,arial,helvetica,sans-serif;
font-size: 14px;
font-weight: bold;
color: #2E181A;
width: 798px;
background: #E6D9BD;
text-align: center;
}
.cssmenu ul {
background: #E6D9BD;
height: 37px;
list-style: none;
margin: 0px auto 0px auto;
padding: 0;
text-align: center;
}
.cssmenu li {
padding: 0px 8px 0px 8px;
display: inline-block;
}
.cssmenu li a {
color: #2E181A;
display: block;
font-weight: bold;
line-height: 37px;
padding: 0px 10px;
text-align: center;
text-decoration: none;
}
.cssmenu li a:hover {
color: #8e8e8e;
text-decoration: none;
}
.cssmenu li ul {
background: #E6D9BD;
border-left: 5px solid #2E181A;
border-right: 5px solid #2E181A;
border-bottom: 5px solid #2E181A;
display: none;
height: auto;
opacity: 0.95;
filter: alpha(opacity=95);
/* For IE8 and earlier */
position: absolute;
width: 225px;
z-index: 200;
float: none;
/*top:1em;
/*left:0;*/;
}
.cssmenu li:hover ul {
display: block;
}
.cssmenu li li {
display: block;
float: none;
padding: 0px;
width: 225px;
}
.cssmenu li ul a {
display: block;
font-size: 12px;
font-style: normal;
padding: 0px 25px 0px 25px;
text-align: left;
}
.cssmenu li ul a:hover {
background: #D5BE91;
color: #000000;
opacity: 1;
filter: alpha(opacity=100);
/* For IE8 and earlier */;
}
.cssmenu p {
clear: left;
}
.cssmenu .active > a {
background:;
color: #ffffff;
}
.cssmenu .active > a:hover {
color: #ffffff;
}
And here's my menu:
<ul class="active">
<li><span>Forside</span>
</li>
<li><span>Hingste</span>
<ul>
<li><span>Volstrups Cash</span>
</li>
<li><span>Churchill</span>
</li>
<li><span>Blejsbjergs Cooper</span>
</li>
<li><span>Con Cosmos</span>
</li>
</ul>
</li>
<li><span>Salgsheste</span>
<ul>
<li><span>Volstrups Charline</span>
</li>
<li><span>Volstrups Calina</span>
</li>
<li><span>Volstrups Colline</span>
</li>
</ul>
</li>
<li><span>Betingelser</span>
</li>
<li><span>Om os</span>
<ul>
<li><span>Heste på stationen</span>
</li>
<li><span>Samarbejdspartnere</span>
</li>
<li><span>Om Stutteriet</span>
</li>
<li><span>Brochure</span>
<ul>
<li><span>Brochure for 2014</span>
</li>
<li><span>Brochure for 2013</span>
</li>
</ul>
</li>
</ul>
</li>
Hope you guys can help me out! :)
you need woking with level3 ul.add some margin-top andleft to 100%
just add this porperty to you css file:
.cssmenu li li:hover > ul{
visibility:visible !important
}
.cssmenu li ul ul {
margin-top: -30px;
left: 100%;
width: 100%;
visibility:hidden;
border-left:none;
margin-left:-5px;
}
.cssmenu li ul ul a{
border-left:5px solid #2E181A;
}
.cssmenu li ul ul li:first-child a{
border-left:none !important;
}
also you don't need add the <a> tag into <span>. you can remove that,

Submenu with distance, on hover is closed

I have a submenu, the problem is my submenu must have more distance and should be visible on hover, so if i'm out of li the submenu goes closed.
Demonstration code on jsfiddle.
HTML code is:
<ul class="menu">
<li> submenu
<ul>
<li>sub item 1
</li>
<li>sub item 2
</li>
<li>sub item 3
</li>
<li>sub item 4
</li>
<li>sub item 5
</li>
<li>sub item 6
</li>
<li>sub item 7
</li>
</ul>
</li>
</ul>
CSS is:
a {
text-decoration: none;
}
ul.menu {
}
ul.menu li {
list-style-type: none;
position: relative;
float: left;
display: inline;
margin: 0px 0px 1px 1px;
padding: 0px 0px 0px 0px;
height: 33px;
line-height: 33px;
}
ul.menu li a {
display: block;
color: #5b615b;
padding: 0px 7px 0px 7px;
background-color: #e1e1e1;
text-transform: uppercase;
}
ul.menu li a:hover {
color: #000000;
background-color: #e1e1e1;
}
ul.menu li ul {
display: none;
font-size: 10px;
width: 100%;
position: absolute;
top: 37px;
left: 0px;
margin: 0px;
padding: 0px;
}
ul.menu li:hover > ul {
display: block;
}
ul.menu li:hover > a {
color: #000000;
background-color: #e1e1e1;
}
ul.menu li:hover > ul {
display: block;
}
ul.menu li ul li {
position: relative;
float: none;
display: block;
height: 22px;
line-height: 22px;
border-bottom: 1px solid #ffffff;
margin: 0px 0px 0px 0px;
padding: 0px 0px 0px 0px;
}
ul.menu li.active ul li a {
color: #5b615b;
background-color: #e1e1e1;
}
Change the top on ul.menu li ul to 33px instead of 37, and add a padding-top of 1px. Updated Fiddle here.
The padding ensures that the hover effect remains active between the elements (padding is part of the element so also has hover).
ul.menu li ul {
display: none;
font-size: 10px;
width: 100%;
position: absolute;
top: 34px;
left: 0px;
margin: 0px;
padding: 0px;
}
change top:37; to top:34; If you want to maintain the whitespace, you can add a 3px white border to the bottom of the top li.
jsfiddle showing this method http://jsfiddle.net/N23AM/4/
visualy identical, just allows the hover to be maintained by the border rather than losing focusing to the background.
The proper solutions would be to add padding-top:20px;(your desired value would be there of course) put in ul li:hover ul selector.
Another, maybe strange solution, that I could think of is to add in your ul submenu a new div that looks like this:
<div style="height:20px; background:transparent; width:100%;"></div>