IE navigation dropdown doesn't display as it should - html

I've created a drop down navigation in html. I then tested it with different browser such as chrome, firefox, opera and IE. The only problem I see is that the navigation doesn't display right in IE.
HTML:
<div id="nav_bar">
<ul id="nav">
<li>Home</li>
<li>Krazie
<ul>
<li>Colour</li>
<br />
<li>Black 'N' Grey</li>
</ul>
</li>
<!-- End of Krazie links -->
<li>Stacy
<ul>
<li>Colour</li>
<br />
<li>Black 'N' Grey</li>
</ul>
</li>
<!-- End of stacy links -->
<li>Matt
<ul>
<li>Colour</li>
<br />
<li>Black 'N' Grey</li>
</ul>
</li>
<!-- End of matt links -->
<li>Contact</li>
</ul>
</div>
CSS:
#nav
{
margin-top:-0px;
background:rgb(108,108,108);
position:fixed;
top:0;
left:0;
z-index:10;
width:100%;
z-index:9003;
height:32px;
list-style:none;
color:#FFF;
}
#nav li
{
float: left;
list-style:none;
}
#nav li a
{
display: block;
height:2em;
line-height:2em;
padding:0px 10px;
text-decoration:none;
list-style:none;
color:#FFF;
}
#nav ul
{
padding:0px;
margin-left:-20px;
background:rgb(108,108,108);
position:absolute;
display:none;
z-index:9003;
list-style:none;
}
#nav ul li a
{
padding:-50px;
width:110px;
list-style:none;
}
#nav li:hover ul
{
display:block;
list-style:none;
}
#nav > li:hover > a
{
background:rgb(108,108,108);
}
#nav ul li:hover a
{
background:rgb(48,48,50);
}
The bit that doesn't display properly is the actual links that you see when you put the mouse over them. This is how it shows on other browser like chrome: http://grab.by/e5ik
but in IE it displays as: http://grab.by/e5im

Your codes seems too complicated to get your work done.
Btw, please remove <br /> in html.
Then, add the following CSS: (between #nav ul and #nav ul li a)
#nav ul li {
clear: both;
}
(tested in IE8)
Please check again in the browsers whether any error occurs.

change this-
#nav ul li a
{
padding:-50px;
width:110px;
list-style:none;
}
#nav li:hover ul
{
display:block;
list-style:none;
}
#nav > li:hover > a
{
background:rgb(108,108,108);
}
#nav ul li:hover a
{
background:rgb(48,48,50);
}
to this-
#nav ul li a
{
padding:-50px;
width:110px;
list-style:none;
display:block
}
#nav a:hover ul
{
display:block;
list-style:none;
}
#nav > li > a:hover
{
background:rgb(108,108,108);
}
#nav ul li a:hover
{
background:rgb(48,48,50);
}
sometimes ie doesn't recognize hovering over elements except a elements.

Related

Issues with custom navigation and displaying submenu on hover

I've been trying to get this menu system to work for a good while now and am after looking at a number of different solutions but nothing seems to be working for me.
At the moment the submenu is appearing when hovering over the top level menu but if I try to move the mouse down to the submenu it disappears again as soon as my mouse leaves the top level.
Also when it does show it is showing behind some of the other page content, I think his might be because I have the page header which contains the navigation in a seperate include() file.
Any help with this would be greatly appreciated, my code is as follows:
HTML:
<div id="nav">
<ul>
<li>Menu
<ul>
<li>category</li>
<li>category</li>
<li>category</li>
</ul></li>
<li>About Us</li>
<li>Contact Us</li>
</ul>
<ul>
<li>Hello,</li>
<li>Sign in</li>
<li>country</li>
<li>cart</li>
</ul>
</div>
CSS:
#nav{
height:50px;
}
#nav > ul{
list-style:none;
padding:0px;
margin:0px;
vertical-align:top;
}
#nav > ul:nth-child(1){
float:left;
height:50px;
line-height:50px;
font-weight:bold;
}
#nav > ul:nth-child(2){
float:right;
height:50px;
line-height:50px;
}
#nav > ul > li {
display: inline-block;
vertical-align:top;
}
#nav > ul:nth-child(1) > li{
width:100px;
}
#nav > ul:nth-child(2) > li{
padding-left:10px;
}
#nav > ul > li > ul{
display:none;
}
#nav > ul > li:hover > ul{
display:block;
z-index:5;
padding:0px;
margin:0px;
width:200px;
}
#nav > ul > li:hover > ul > li{
background: #fff;
border:1px solid #bbb;
display:block;
padding:10px;
line-height:16px;
font-weight:normal;
}
#nav > ul > li:hover > ul > li > a{
color:#333;
}
You are almost done, you need to set a z-index, and position: relative. This is because z-index needs to be set with a position (more information here and here).
#nav{
height:50px;
}
#nav > ul{
list-style:none;
padding:0px;
margin:0px;
vertical-align:top;
}
#nav > ul:nth-child(1){
float:left;
height:50px;
line-height:50px;
font-weight:bold;
}
#nav > ul:nth-child(2){
float:right;
height:50px;
line-height:50px;
}
#nav > ul > li {
display: inline-block;
vertical-align:top;
}
#nav > ul:nth-child(1) > li{
width:100px;
}
#nav > ul:nth-child(2) > li{
padding-left:10px;
}
#nav > ul > li > ul{
display:none;
}
#nav > ul > li:hover > ul{
display:block;
z-index:5;
padding:0px;
margin:0px;
width:200px;
}
#nav > ul > li:hover > ul > li{
background: #fff;
border:1px solid #bbb;
display:block;
padding:10px;
line-height:16px;
font-weight:normal;
background:red;
z-index:10;
position:relative;
}
#nav > ul > li:hover > ul > li > a{
color:#333;
}
<div id="nav">
<ul>
<li>Menu
<ul>
<li>category</li>
<li>category</li>
<li>category</li>
</ul></li>
<li>About Us</li>
<li>Contact Us</li>
</ul>
<ul>
<li>Hello,</li>
<li>Sign in</li>
<li>country</li>
<li>cart</li>
</ul>
</div>
<div>
Some content
</div>
Note that I've set a background color to see that works.

CSS overlay with menu collapsible

How i make the child lists expand and collapse by click ?
.tree-list li > ul{
display: none;
}
See the Pen Pure CSS Fullscreen Overlay Menu .
You can use it by jquery/javascript or you can simply use css for hover.
for jquery just write onclick ul display:block along with this css.
<nav id="dropdown">
<ul>
<li>Menu
<ul>
<li> 1</li>
<li> 2</li>
<li> 3</li>
</ul>
</nav>
In CSS
#dropdown
{
margin-top:15px
}
#dropdown ul
{
list-style:none;
position:relative;
float:left;
margin:0;
padding:0
}
#dropdown ul a
{
display:block;
color:#333;
text-decoration:none;
font-weight:700;
font-size:12px;
line-height:32px;
padding:0 15px;
font-family:"HelveticaNeue","Helvetica Neue",Helvetica,Arial,sans-serif
}
#dropdown ul li
{
position:relative;
float:left;
margin:0;
padding:0
}
#dropdown ul li:hover
{
background:#f6f6f6
}
#dropdown ul ul
{
display:none;
position:absolute;
top:100%;
left:0;
background:#fff;
padding:0
}
#dropdown ul ul li
{
float:none;
width:200px
}
#dropdown ul ul a
{
line-height:120%;
padding:10px 15px
}
#dropdown ul ul ul
{
top:0;
left:100%
}
#dropdown ul li:hover > ul
{
display:block
}

Creating dropdown submenu

Hi There can anyone help me i try to create a dropdown submenu but it doesn't work for me.
I dont know how to reate a nice menu.
example:
When i hover over "massages" then the menu must come down and show the submenu.
css here
.menu{
width:821px;
height:42px;
margin:0px;
background:url(images/menu.gif) no-repeat left;
}
.menu ul{
list-style:none;
padding:0 0 0 15px;
margin:0px;
}
.menu ul li{
display:inline;
}
.menu ul li ul{
display:inline;
}
.menu ul li a{
float:left;
height:42px;
border:none;
padding:0 15px 0 15px;
text-decoration:none;
color:#fff;
line-height:42px;
font-size:14px;
}
.menu ul li.aktivni-active a{
float:left;
height:42px;
border:none;
padding:0 15px 0 15px;
text-decoration:none;
line-height:42px;
font-size:14px;
Html:
<div class="menu">
<ul>
<li class="aktivni-active">Home</li>
<li>Massages</li>
<ul>
<li>Aanbiedingen</li>
</ul>
<li>Aanbiedingen</li>
<li>Prijzen</li>
<li>Agenda</li>
<li>Contact</li>
</ul>
</div>
Can anyone explane me how to create a dorpdown submenu on "Massages"
Thnx
Check with the below link.
Fiddle
/* Menu Dropdown */
ul#menu, ul#menu ul.sub-menu {
padding:0;
margin: 0;
}
ul#menu li, ul#menu ul.sub-menu li {
list-style-type: none;
display: inline-block;
}
/*Link Appearance*/
ul#menu li a, ul#menu li ul.sub-menu li a {
text-decoration: none;
color: #fff;
background: #666;
padding: 5px;
display:inline-block;
}
/*Make the parent of sub-menu relative*/
ul#menu li {
position: relative;
}
/*sub menu*/
ul#menu li ul.sub-menu {
display:none;
position: absolute;
top: 30px;
left: 0;
}
ul#menu li ul.sub-menu a {
width:150px;
}
ul#menu li:hover ul.sub-menu {
display:block;
}
/* Top Nav Background Hover */
ul#menu li a:hover {
background:#000;
}
ul#menu li ul li a:hover {
background:#999;
}
/* 3rd level nav */
ul#menu li ul.sub-menu li ul {
display:none;
position: absolute;
top: 0px;
left: 115px;
width: 100px;
}
/* show the 3rd level when the second is hover */
ul#menu li ul.sub-menu li:hover ul {
display:block;
}
/* Menu Dropdown */
You should change your markup, as far as I know submenu should be part of list item it refers to
<ul>
<li class="simple-item">item</li>
<li class="submenu">item
<ul class="submenu-goes-inside-li">
<li class="simple-item">item</li>
<li class="simple-item">item</li>
<li class="simple-item">item</li>
</ul>
</li>
</ul
In your case submenu is separated from list items.
Using the same structure you have just add class to the drop menu,
set ul inside the dropMenu to display none, then to display on however. You can use css3 or jquery to make it have a nice animation or toggle.
<div class="menu">
<ul>
<li class="aktivni-active">Home</li>
<li class="dropMenu">Massages</li>
<ul>
<li>Aanbiedingen</li>
</ul>
<li>Aanbiedingen</li>
<li>Prijzen</li>
<li>Agenda</li>
<li>Contact</li>
</ul>
</div>
CSS
.menu ul{
display:none
}
.menu:hover ul{
display:block;
}
if you want some better just use jquery http://api.jquery.com/toggle/

CSS Adjust height of background-color while hovering on weblink (<a> tag)

I'm currently designing a Nav menu that includes ul, li and a elements. I'm trying to produce an effect where hovering over an a tag will only change the background color near the text for the link itself instead of the whole li area around it.
HTML:
<nav>
<div class="full_menu">
<ul>
<li>Login</li>
<li>About</li>
<li>FAQ</li>
<li>Blog</li>
<li>Our Team
<ul>
<li>Bob</li>
<li>James</li>
<li>Tom</li>
</ul>
</li><!--End team dropdown -->
</ul>
</div>
CSS:
nav {
margin:0 auto;
text-align:center;
}
nav ul ul {
display: none;
}
nav ul li:hover > ul {
display:block;
}
nav ul {
background: #17A74A;
padding:0px;
list-style:none;
position:relative;
display: inline;
border:0px;
}
nav ul li {
float:right;
margin-top:0px;
}
nav ul li a {
display:block;
padding:33px 40px;
color:#000;
text-decoration:none;
font-weight:bold;
font-size:18px;
}
nav ul li a:hover {
background-color:#2D6AF7;
color:#FFF;
}
nav ul ul {
background:#17A74A;
position:absolute;
top:71px;
}
nav ul ul li {
float:none;
border-bottom:1px solid #FFFFFF;
}
nav ul ul li a {
padding:15px 40px;
color:#FFF;
}
nav ul ul li a:hover {
background:#27BCDD;
}
nav ul ul ul {
position:absolute;
left:100%;
top:0;
}
I thought that by using nav ul li a:hover would fix this problem but the whole li area is still changing its background color instead of just the immediate area around the link text.
Any help would be greatly appreciated!
Do you want to achieve following result? I've removed the padding from your <a> elements and added them to the <li> elements instead.
JSFiddle
You need to change the padding to a margin if you don't want the whole thing to change color. Try this:
nav ul ul li a {
margin:15px 40px;
color:#FFF;
}

Dropdown menu sizing

I need to align this navigation menu centered horizontally on the page. I would also like to reduce the size of the box the text appears in.
JSFiddle: http://jsfiddle.net/6W2qm/
HTML
<nav>
<ul class="navigation">
<li>Home</li>
<li>Biography</li>
<li>Media
<ul>
<li>Pictures</li>
<li>Videos</li>
</ul>
</li>
<li>Tour</li>
<li>Contact</li>
</ul>
</nav>
CSS
nav {
height:100px;
list-style:none;
text-align:center;
width:1024px;
}
nav ul ul {
display:none;
padding:0;
position:absolute;
top:10%;
}
nav ul li:hover > ul {
display:block;
}
nav ul {
list-style:none;
margin:0;
padding:0;
position:relative;
}
nav ul:after {
clear:both;
content:"";
display:block;
}
nav ul li {
float:left;
width:100px;
}
nav ul li a {
display:block;
padding:25px 40px;
text-decoration:none;
width:0;
}
nav ul ul li {
float:none;
position:relative;
}
nav ul ul li a {
padding:15px 40px;
}
I can't tell about the rest of your page when you only provided a small amount of the code, but this looks OK now.
JSFiddle: http://jsfiddle.net/D9z3s/
I changed the following line to 50% instead of 10% and it doesn't overlap anymore:
nav ul ul {
padding: 0;
position: absolute;
top: 50%;
}