SELECT dropdown -- limit width of box, but allow OPTIONs to be full width

Posted on 2004-11-30
Last Modified: 2012-06-21
Apologies if this has been answered previously--I couldn't find a reference.

I am writing for IE6, and want to create a SELECT menu that is of fixed width, yet when clicked allows the drop-down menu to expand to the width of the longest OPTION.  I'm guessing that overflow: auto fixes this in Netscape, but that doesn't work for me.  Is the only solution to make my own menu?

Thank you,

Question by:roblinx
    LVL 23

    Assisted Solution

    to control the width you can use CSS and it will be respected by most modern browsers. Just put this in the head of the page:

    <style type="text/css">
    select {width:100px"}

    Of course if any of the options are wider than the specified width they will get cut off.

    As for the bold, you can change the font-weight for the select but not the individual options. the only styling you can use for options is the color and background color.  So you cond do something like this for an option you want to stan out:

    <option style="color:red">your text</option>

    answer from Cd& - (Give credit where it is due)
    LVL 23

    Expert Comment

    roblinx did this help?
    LVL 10

    Accepted Solution

    Yes you will need to create your own menus.

    Author Comment

    apresto, your answer was valid, but I didn't phrase my question well, so it didn't quite get what I was looking for.  dij8's answer, unfortunately, seems to be correct:  I can't do what I want to do with stock objects for IE--I'll have to make my own.

    I'll just split the points between you, since you were good enough to read my question and give an answer.  Thank you!
    LVL 23

    Expert Comment

    Thanks roblinx, sorry it wasnt quite what you were looking for.  Hope you sort it out
    LVL 10

    Expert Comment

    If it's a navigation menu you are looking for there are a multitude of them around the Net. always has a few.  A search on Google will find the rest.  I'd recommend finding one that uses mostly CSS and no tables.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
    Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
    Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
    The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now