Results 1 to 7 of 7

Thread: DropDown menu

  1. #1

    Thread Starter
    Hyperactive Member parkes's Avatar
    Join Date
    Jan 1999
    Location
    Unitied Kingdom
    Posts
    303

    Question

    Does anyone know if its possible to set the width of a dropdown menu on an ASP page.
    Thanks in advance for any help provided.

    VB 6 Enterprise Edition SP4
    ADO, SQL 7/2000, ASP and some JavaScript


    >> Life goes on, but for how long? <<
    If you can smile when things go wrong, you have someone in mind to blame

  2. #2
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    Dont think there is. Its always as wide as your longest item.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  3. #3
    New Member
    Join Date
    Feb 2001
    Posts
    6

    Wink

    There is a way - I found it by accident.

    I tried everything, and I couldn't find a way to set the width of a drop down box; I tried setting the width of the form, the width of the <select> tag, the width of the <option> tags. Nothing. Then I just-for-the-hell-of-it thought try CSS. So I created a one-line CSS file;

    select {width : 450 }

    and saved it as build.css (the name was relevant to the project I was doing)

    then added the following line in the <HEAD> section of the file with the drop down boxes that needed formatting;

    <LINK REL="StyleSheet" TYPE="text/css" REF="build.css">

    And voila, it worked ! Now, I don't know if all browsers will format this properly, especially Netscape, but I know it works in IE 5+.

    If you want to see a working example and download some very basic code done in about a minute goto
    http://www.nickclarkson.co.uk/dropdown.html
    In the example I created a subclass called alternative to demonstrate how easy it is to change the width. If you need any more information on CSS try http://www.w3schools.com/css - it's a really good site.

    (Oh and the site is new, so there's not a lot there

    Nick Clarkson

  4. #4
    PowerPoster abdul's Avatar
    Join Date
    Dec 2000
    Location
    Ontario,Canada
    Posts
    2,827

    Cool I got it

    Hi now i got the answer!
    use the style sheet in the select tag like this:


    <select style="width: 344px">
    </select>


    The width is 344 pixels. You can make it as wider as you can.

    This one should work!!!!!!
    Baaaaaaaaah

  5. #5
    New Member
    Join Date
    Feb 2001
    Posts
    6

    Red face

    Abdul,

    You mean a bit like I said in my post about 12 hours ago ?

  6. #6
    PowerPoster abdul's Avatar
    Join Date
    Dec 2000
    Location
    Ontario,Canada
    Posts
    2,827

    Wink Sorry!

    Sorry guy!
    Actually I did not look at your code. I already knew that becasue I used Ms Script program.
    Baaaaaaaaah

  7. #7

    Thread Starter
    Hyperactive Member parkes's Avatar
    Join Date
    Jan 1999
    Location
    Unitied Kingdom
    Posts
    303

    Talking

    Thanks everyone that sorted it
    Thanks in advance for any help provided.

    VB 6 Enterprise Edition SP4
    ADO, SQL 7/2000, ASP and some JavaScript


    >> Life goes on, but for how long? <<
    If you can smile when things go wrong, you have someone in mind to blame

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width