Issue with navigation functionality in Internet Explorer 8 - lack of background color and sub menus missing inline styling

Just dipping my toes into the world of CSS and html5, I followed this tutorial to create a basic pure CSS/html5 drop-down menu. Unfortunately, it's not functioning properly in IE8. I included the HTML shiv and applied a display:block style to all html5 elements in my stylesheet.

The drop-down feature works and submenus change color when hovered over in IE8, but there is no background color and the submenus don't align correctly or display as inline elements even though this was specified in the CSS.

nav ul li{
          display: inline-table; <-- being ignored
          float:left;   <-- being ignored
         }

As for the background color for the list (used colorzilla to generate gradient code below)

nav ul {

background: rgb(87,179,229); Old browsers - doesn't work
/* Gradient code for different browsers */
box-shadow: 0px 0px 9px rgba(0,0,0,0.15);
padding: 0 20px;
border-radius: 0px;
list-style: none;
position: relative;
display: inline-table; <-- Not ignored in ie8

                }

Any suggestions on how to get it working in IE8? I've heard that IE8 doesn't play well with child elements inheriting styles within the nav/list hierarchy. However, if styles are explicitly defined, shouldn't they apply regardless? Could it be that IE8 still doesn't fully recognize the nav/ul tags?

Appreciate any assistance. Thank you!

Answer №1

It appears that your HTML5 shim is functioning properly, as it is following the declaration in nav ul. However, there may be another issue causing the problem.

Have you considered why you are using inline-table for the li elements? You might want to experiment with changing them to display: block or even display: table-cell without the float to see if that achieves the desired effect. Additionally, checking the page in IE9 with developer tools set to "IE8 mode" can help identify any conflicting stylesheets or specific declarations affecting the layout.

It's important to note that display: inline-table (and other display properties beyond block and inline) may not function correctly in IE7, so keep this in mind if you need to support that browser version.

Answer №2

To enhance your web page, you can include the following JavaScript code snippet to ensure compatibility with HTML5 elements on Internet Explorer:

(function(){if(!/*@cc_on!@*/0)return;var elements = "abbr,article,aside,audio,bb,canvas,datagrid,datalist,details,dialog,eventsource,figure,footer,header,hgroup,mark,menu,meter,nav,output,progress,section,time,video".split(','),i=elements.length;while(i--){document.createElement(elements[i])}})()

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

What steps should I take to adjust the text size in my media query?

I'm facing a challenge with a media query to decrease the font size of a text. It seems like a straightforward task, yet I can't pinpoint the issue. HTML: <div class="fp-featured"> <div class="fp-title">TITLE</div> <p class ...

Creating artwork using a "graphite drawing tool" on a blank canvas

I created a script that draws a series of lines on a canvas, giving it a sketch-like appearance. However, I have encountered two issues with the script. Firstly, why is the y value appearing to be twice as much as it should be? Secondly, why is the line w ...

Is the page reloading automatically after updating the innerHTML content?

Trying my hand at creating a JavaScript/HTML page that automatically generates an audio player when provided with a URL. However, every time I click the generated button, the audio player is inserted but then disappears as if the page is refreshing. Here ...

Tips for changing the visibility of a div within table rows upon clicking

Struggling to solve this jQuery issue with a table that displays numbers on each row. I want to be able to click on one of the numbers, which is a href link, and toggle only the corresponding div called "test" instead of toggling all rows at once. How can ...

Manipulating CSS animations using JavaScript

Recently, I've been working on a basic keyframe animation. The animation is set to blink truck lights: animation: blink-truck-lights .4s 8s 10s steps(2) 2 forwards; @keyframes blink-truck-lights { from{background-position: 0px 0;} to{background-pos ...

The complete guide to effectively concealing double arrows within a Bootstrap 4 custom-select component

If you're looking to hide the double arrow on the right of the bootstrap 4 custom-select field, there have been solutions provided here. However, even after implementing those changes, the text on the right-hand side still gets obscured by the opaque ...

Exploring the implementation of an if condition within a button tag

Currently, I am a beginner in the field of web development and I have encountered an issue while trying to implement a certain logic. Here is the button tag that I am working with: <td> <input style="word-wrap: break-word;white-space: normal; ...

Ways to implement a custom scrollbar across an entire webpage:

I am trying to implement the Jquery custom content scroller on my webpage to replace the default scrollbar. However, I am facing difficulties in getting it to work properly. You can view my code on Codepen. Although the plugin works fine with smaller blo ...

What is preventing me from showing the search results?

Below is the PHP code I am using: <?php $dbhost = 'localhost'; $dbuser = 'root'; $dbpass = ''; $dbname = 'moviefone'; $con = mysql_connect($dbhost, $dbuser, $dbpass); mysql_select_db($dbname, $con); if (mysqli ...

Guide to setting up a search function with class name filtering

I am currently managing a website with multiple items, each represented by individual div elements. While all items share one common class name, they also have several other class names serving as tags to differentiate them (some tags may overlap between d ...

Tips for utilizing the "Sign In with Apple" feature through Apple JS

For implementing "Sign In with Apple" on a web platform using Apple JS, you can refer to the code example available at this link. Now, the query arises: where can I find the Client ID required for this process? I have tried using the app id identifier fro ...

Vue.js is experiencing functionality issues on mobile devices and other connected devices, however, it is operating smoothly on desktop devices when localhost is running

I recently ran into an issue while trying to run my Laravel project on localhost and connect it to other devices like mobiles and desktops/laptops using the local address. The function works perfectly on the hosting desktop but fails to work on other devic ...

Selecting a variety of shapes from a painting

Within my canvas, there are various shapes like ovals, triangles, and squares. I am curious to know if it is possible to obtain a reference to one of these objects and animate it whenever a specific event occurs. Appreciate your attention to this query. I ...

The functionality of jQuery's $.inArray does not seem to be compatible with ASCII characters

I've demonstrated the issue in this jsfiddle. The scenario involves two black coins - when one black coin is placed on another, it should trigger an alert saying "can't kill your own kind" and return the coins to their original positions. However ...

Dynamic value for textbox using Selenium

While working on building a test case, I encountered a problem with a search text box on my web page. The Selenium IDE was used to record the actions taken. type | id=search_input_char_name_136 | myproduct // textbox for search click | css=button.oe_ ...

Steps for inserting a clickable phone number link within innerHTML1. First, create an

I've been trying to include a specific phone number using the <a href> tag within the innerHTML. I attempted using both double and single quotes. In the first case, nothing happens at all. In the second case, although the phone number appears, ...

Transferring checkbox data to Bootstrap modals and dynamically summoning specific div modals using their unique identifiers

I have been trying to populate the checkbox values into corresponding modal divs based on button clicks, but I am facing difficulties in achieving it. Desired outcome: The buttons should trigger the display of selected checkbox values in their respective ...

The alignment of Bootstrap text is not in alignment

Hi there, I am pretty new to bootstrap and have been hunting for a solution regarding this specific layout that I want to achieve. Check out the image below: https://i.sstatic.net/qqaCo.png The issue I am facing is that in my code, the name, code, status, ...

Public static function that sends AJAX requests

I am trying to implement a functionality to add a like to the database across multiple pages. I have created a page where I can insert likes and included this page on all other pages. However, the issue I am facing is that every time I like something, the ...

Although AJAX $.post functions properly in the View, it seems to encounter issues when relocated to a separate .js file. Interestingly, all other JQuery functions work

I have recently delved into MVC, JQuery, and AJAX, and encountered a perplexing issue. After completing the initial development of a practice website, I dedicated time to enhance the interactivity using JQuery. Everything was functioning smoothly until I ...