Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

CSS menu appearing behind divs in IE

Featured Replies

I have implemented a vertical flyout css menu into a site I am re-coding.

 

The menu was taken from dynamic drive.

 

I just got to the point where it is customised to how I need it, however, the problem is in IE, the fly out box's are appearing behind the main content.

 

Heres a link to the site.

 

I managed to get them to appear infront in FF using z-index but this is not working on IE.

 

Can anyone shed any light. thanks.

 

#menu {
height: 350px;
width: 160px;
position: relative;
margin-top: 5px;
margin-bottom: 10px;
background-color: #808080;
padding-top: 5px;
padding-right: 5px;
padding-left: 5px;
z-index: 16;
font-size: 0.9em;
}

.suckerdiv ul{
margin: 0;
list-style-type: none;
width: 160px;
padding-top: 0;
padding-right: 0;
padding-bottom: 0;
padding-left: 0;
}

.suckerdiv ul li{
position: relative;
}

/*Sub level menu items */
.suckerdiv ul li ul{
position: absolute;
width: 160px; /*sub menu width*/
top: 0;
visibility: hidden;
}
.suckerdiv /* End */
ul  li  ul  li a {
border-right-width: 1px;
border-left-width: 1px;
border-right-style: solid;
border-left-style: solid;
border-right-color: #FFFFFF;
border-left-color: #FFFFFF;
padding-left: 2px;
}
.suckerdiv ul li ul li a:hover {
background-color: #012B7F;
padding-left: 3px;
}

/* Sub level menu links style */
.suckerdiv ul li a{
display: block;
overflow: auto; /*force hasLayout in IE7 */
color: #F4F4F4;
text-decoration: none;
background-color: #808080;
border-bottom-width: 1px;
border-bottom-style: solid;
border-bottom-color: #F4F4F4;
padding-top: 5px;
padding-right: 5px;
padding-bottom: 5px;
padding-left: 0px;
font-size: 0.9em;
font-family: Verdana, Arial, Helvetica, sans-serif;
}

.suckerdiv ul li a:visited{
color: #CCCCCC;
}

.suckerdiv ul li a:hover{
background-color: #D81E05;
padding-left: 2px;
}

.suckerdiv .subfolderstyle{
background-image: url(images/arrow-list.gif);
background-repeat: no-repeat;
background-position: right center;
}


/* Holly Hack for IE \*/
* html .suckerdiv ul li { float: left; height: 1%; }
* html .suckerdiv ul li a { height: 1%; }
.top {
border-top-width: 1px;
border-top-style: solid;
border-top-color: #FFFFFF;
}

Hi Mark, the problem is the way that IE calculates z-index. Read here for a good explanation.

I haven't had a good look at your code but if you put a z-index on #main_content that is lower than the z-index:16 on #menu, that might sort it out. If not take a look at the link I've given you.

If you need a hand, just ask.

  • Author

thanks for the help. it doesnt look like it has worked though! :(

 

I came accross this issue a couple of years back and solved it, i have no idea how though,

Remove

position:relative;

from all of the elements in your #main_content that don't require it.

This is causing a lot of the problems with IE

  • Author

Thanks, ive done that, what issues was it creating just out of interest?

 

I think I have may solved the css behind div issue, I put the navigation menu below the content in the code and floated it.

For some reason, IE recalculates the z-index of elements every time it encounters a relatively positioned element and sets the z-index to auto.

That link I gave you before explains it better than I can.

Glad you've got it sorted. :)

  • Author

was just reading that link properly, very strange why it does that!

 

So frsutrating when you get something perfect in FF then shut your eyes and open up IE only to find it needs changing! Oh the joys!

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.