Arrangement of nested lists in Internet Explorer

I'm currently developing a dynamic side menu using CSS and HTML. The menu functions perfectly in all browsers except for Internet Explorer. In IE, the nested lists that create the submenu appear about 50 pixels too far to the right, causing a gap between the sub and main menus. You can find the menu on the left side of this page.

Below is the code snippet:

div.sidemenu{width:200px;}
div.sidemenu ul{background:#EBEBEB;list-style:none;margin:0;padding:0;width:200px;}
div.sidemenu li{float:none;font-size:1.2em;}
div.sidemenu li a{color:#333333;display:block;line-height:35px;text-align:left;text-decoration:none;margin:0px;padding:5px;text-align:left;text-decoration:none}
div.sidemenu li a:hover, .sidemenu ul li:hover a{background: #cccccc url('images/hover.gif') bottom center no-repeat;color:#333333;text-decoration:none;}
div.sidemenu li ul{background:#EBEBEB;display:none;height:auto;padding:0px;margin-left:200px;margin-top:-32px;border:0px;position:absolute;width:220px;z-index:200;/*top:1em;/*left:0;*/}
div.sidemenu li:hover ul{display:block;}
div.sidemenu li li {background:url('images/sub_sep.gif') bottom left no-repeat;display:block;float:none;margin:0px;padding:0px;width:220px;font-size:1.1em;}
div.sidemenu li:hover li a{background:none;}
div.sidemenu li ul a{display:block;margin:0px;padding:0px 10px 0px 15px;text-align:left;}
div.sidemenu li ul a:hover, .sidemenu li ul li:hover a{background:#cccccc url('images/hover_sub.gif') center left no-repeat;border:0px;color:#333333;text-decoration:none;}
div.sidemenu p{clear:left;}
div.sidemenu img {padding:0px 15px 5px 2px;width:25px;height:25px;}

<div class="sidemenu"><
<ul><
   <li><a href="#"><img src="/icon_excel_small.jpg"><span>Excel Training</span></a><
      <ul><
         <li><a href="#"><span>Basic</span></a></li><
         <li><a href="#"><span>Intermediate</span></a></li><
         <li><a href="#"><span>Advanced</span></a></li><
      </ul><
   </li><
   <li><a href="#"><img src="/icon_access_small.jpg"><span>Access Training</span></a><
      <ul><
         <li><a href="#"><span>Basic</span></a></li><
         <li><a href="#"><span>Intermediate</span></a></li><
         <li><a href="#"><span>Advanced</span></a></li><
      </ul><
    </li><
</ul><
</div><

Your assistance is greatly appreciated. Steven

Answer №1

Instead of battling with IE, I have found a solution by incorporating specific CSS for IE only. Feel free to customize the 50 pixels and tailor it to fit your needs in IE.

<!--[if IE]> <link href="/css/ie.css" rel="stylesheet" type="text/css"> <![endif]-->

Answer №2

Perhaps this could be of assistance.

To the primary LI elements at the top level, apply position:relative

For the submenu UL elements, eliminate the margin-left and introduce left:200px

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Run JavaScript Function from Within

Apologies for the straightforward question, but I'm struggling to find an answer anywhere. As a complete JavaScript beginner with no experience, I'm at a loss. Currently, I have a function linked to a simple button click: <input type="button ...

What is the best method to position images in the same way as seen in the screenshot

Any tips on aligning images shown in the screenshot? Please note that the images will be from the backend. https://i.stack.imgur.com/LnYLM.jpg I experimented with code to position images using top, right, left, and bottom properties, but it becomes cumb ...

What is the method to include a data attribute without a value in a React createElement?

When adding a div to the DOM using React, it can be done as follows: React.createElement("div", { className: "test", "data-test": true }); The resulting HTML should look like this: <div class="test" data-test> </div> I am wondering where ex ...

How can I showcase CSV data as clickable links and images on a website using HTML?

Looking for a way to display CSV file links as clickable hyperlinks in a table? Want to directly show images from photo links on your website as well? Wondering if this is even possible? Successfully showcased desired content in a table with the code prov ...

transferring the parsed JSON document to the recipient, however, it does not adhere to

After calling the API and parsing the JSON data, I now aim to present this parsed JSON in tabular form on the receiving page. Currently, it is being displayed as plain text. The API URL used for testing purposes has been sourced from WIKI to safeguard act ...

External CSS file for Demandware platform

My boss was supposed to train me this year on demandaware knowledge, but ended up quitting, leaving me in the dark. I am scheduled to attend workshops later this year, but for now I am relying on Google and stackoverflow for guidance. Currently, I am wor ...

`Thoughts on Difficulty Attaching Child Elements in JavaScript with appendChild`

I am having trouble with appending some HTML that is being received as a string in a div. For some reason, the appendChild method is not working as expected. Here is my JavaScript code: var doc = document.getElementById("products"); var notes = doc.getEle ...

Highcharts: Show tooltip above all elements

Is there a way to configure tooltip display above all elements? I want to define specific coordinates so that the tooltip remains open even if it is covering the chart, and only closes when interacting with the top block. Screenshot 1 Screenshot 2 For e ...

The checkbox display and hide functionality is mistakenly inverted

I have a form set up with an input field that should show or hide depending on whether a checkbox is clicked. Currently, the field is showing and hides when the checkbox is clicked. How can I reverse this behavior so that it works the other way around? ...

transmitting a communication from express to a web page

Looking for guidance on sending a warning message from Express to the browser in my current project, which involves a MEAN app. Communicating between Express and HTML is proving to be a challenge, so any assistance would be greatly appreciated. ...

Ongoing Loop Needed for Banner

After some exploration in my previous post about creating banners, I have gained a better understanding of some new concepts... function animate(el) { var div = $(el); return div.css("display","block").animate({width:0},1).animate({width:1100},2000).d ...

Is it possible for me to designate a specific class for the rev value?

<a href="img1.jpg" rel="zoom-id:bike" rev="img1.jpg"> <img src="" class="img-thumb"/></a> Shown above is a snippet of HTML code. I wonder if it's possible for the attribute rev="img1.jpg" to have a class that only affects the s ...

CSS animation fails to execute

I created a rotating carousel using CSS. The carousel is constructed using the 'ul' tag. To navigate left or right, I dynamically add a 'li' element to the left or right of the list by cloning the necessary value and appending/prependin ...

Issue in insert.php file: stdClass::$variable property is undefined when using Ionic, Angular, and PHP together

There are three files. Once the submit button is clicked on the Ionic page, all inputs will be sent to the controller, which will then parse them to insert.php. The form input data is saved successfully when only using HTML (without Ionic content), however ...

Performing arithmetic calculations using HTML

Can math operations be done directly within an HTML element, such as <div width="50/2">, or is it necessary to use Javascript or CSS for this functionality? ...

Show the chosen item from a dropdown menu using Bootstrap

Here is the HTML code that I am working with: <!DOCTYPE html> <html> <head> <title>Bootstrap Example</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="h ...

Issues with PHP session functionality on the server

I am currently developing a straightforward ticket tracking system using PHP and sessions, but I am encountering some difficulties. Here are the main pages involved in this project: admin.php (allows users to create, edit, and delete tickets) login.php ( ...

Enhance the functionality of the Bootstrap navbar by enabling the slideUp and slideDown effects

I can't get jQuery's slideUp and slideDown methods to smoothly animate the Bootstrap navbar. When I tried using the slideUp method, the navbar only slid up a little before disappearing completely, and the same issue occurred with the slideDown me ...

Trouble with bootstrap card-columns - displaying jumble

Struggling to create masonry cards using Bootstrap 4? Everything seems fine until adding the card-columns class. https://i.sstatic.net/N845w.png Here's my HTML: <div class="wrapper"> <div class="container-fluid"> ...

Refine your search by name following the implementation of a character-altering filter

Encountered a scenario in which there is a need to filter elements generated by the 'ng-repeat' directive. I have implemented a custom filter that replaces one character with another and vice versa for each element created. However, when attempt ...