Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6151797
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:49:08+00:00 2026-05-23T19:49:08+00:00

I am using a drop down menu for a website and in IE8 it

  • 0

I am using a drop down menu for a website and in IE8 it works just fine, but when I go into compatability mode the drop down menu looks wrong. The background color is only as wide as the text in each list element. Here is a image of the issue.

enter image description here

Here is how it looks in IE8, which is the correct way:

enter image description here

The one css property that doesnt seem to work in compatibility mode is the min-width, which Im assuming compatibility mode is an older version of IE? Or at least I am assuming this issue would happen in IE7. Here is the css property for this menu:

#main_menu li ul {
    margin:0;
    padding:0;
    position:absolute;
    visibility:hidden;
    border:no-border;
}

#main_menu li ul li {
    float:none;
    display:inline;
}

#main_menu li ul li a {
    background:#efefef;
    color:#24313C;
    text-align:left;
    text-transform:none;
    font-weight:normal;
    letter-spacing:normal;
    min-width:70px;
}

Any idea how to get the older version if IE to work like how it looks in IE8?

EDIT:
Here is the image when adding display:block and width:70px. As you can see it cuts off, trying to have it automatically expand to the longest text in the menu like it would in IE8.

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T19:49:08+00:00Added an answer on May 23, 2026 at 7:49 pm

    What will probably work best is to detect the widest element using JavaScript, then set the elements to that width – see jsfiddle (http://jsfiddle.net/NneMQ/). I checked in IE7 and it works as far as I understand your requirements.

    The jQuery I used was:

        $(function () {
            var target = $('#main_menu li ul li');
            var target_array = [];
            target.each(function (i) {
                target_array[i] = $(this).width();
            });
            // get widest element and add 10px of padding on the right
            var max_width = Math.max.apply(null, target_array)+10; 
            target.find('a').css( { 'width': max_width + 'px', 'display': 'block' } );
    
        });
    

    EDIT:

    Good catch. I updated the code to work with multiple lists. It works in IE7 and in IE8 compatibility mode (which is designed to emulate IE7 anyway):

    See http://jsfiddle.net/g_thom/NneMQ/1/

    Updated jQuery:

        var target = $('#main_menu > li');
        var target_array = [];
        target.each(function (i) {
            $(this).find('li').each(function (j) {
                target_array[j] = $(this).width();
            });
            // get widest element and add right padding of 10 px
            var max_width = Math.max.apply(null, target_array)+10;
            target.eq(i).find('a').css( { 'width': max_width + 'px', 'display': 'block' } );
        });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to make a drop down menu using javascript/jquery but can't get my
I am using a Drop Down List for selecting some options. Everything works fine,
I'm using the following code for a drop down menu but I want the
I'm using this for displaying a drop down menu. It works in all browsers
I created drop down list using java. But i am not aware of creating
I am using the AJAX Cascading drop down list but want to add event
I am using a drop down menu, with all its code written in .js
I'm dynamically creating option elements for a drop down menu using Javascript and would
i am using jquery drop down menu and under the menu i am using
How to set the max height of a css drop-down menu without using javascript?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.