Results 1 to 5 of 5

Thread: Changing look of dropdown boxes using CSS

  1. #1
    Join Date
    Apr 2006
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Changing look of dropdown boxes using CSS

    Hi All,

    I know you can change the look on input boxes using CSS. ie changing border size, colour and text area but for some reason I can't do the same using the select function (ie dropdowns). Is there a way of doing this using CSS or is this function restricted on dropdowns.

    Thanks for your help.

    Regards
    Frogger

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    It depends upon the browser but, almost all browsers have certain limitations when it comes to styling the select element. Its functionality is paramount and as it has a rather complex functionality compared to other elements, this I suppose is why style has been given short shrift. However greater control than you realize may be possible, certainly in some browsers. What exactly did you want your select element to look like?
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Apr 2006
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks for getting back to me. Just wanted to change the border colour and the arrow box. I know changing the fonts style and size along with the background colour is possible to do.

    Regards
    Frogger

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    As far as I know the arrow box is off limits. The border may be able to be manipulated in some, if not all browsers. For example, you can do custom borders in FF and Opera but not in IE. However, borders are usually easy to simulate but, perhaps not with a select, I'll look into that.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    This type of scheme seems to do borders in IE and other browsers but it is tricky:

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
    <html>
    <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <style type="text/css">
    #sel select {
    height:100%;
    }
    * html #sel select {
    margin-bottom:5px;
    }
    #sel {
    border:5px solid green;
    }
    body>#sel {
    border-top-width:6px;
    border-bottom-width:7px;
    }
    </style>
    </head>
    <body><br>
    <span id="sel"><select>
    <option>jjjjj</option>
    <option>jjjjj</option>
    <option>jjjjj</option>
    <option>jjjjj</option>
    <option>jjjjj</option>
    </select></span>
    </body>
    </html>
    Here are the styles commented:

    Code:
    #sel select {
    height:100%; /*Opera needs this for a balanced look*/
    }
    * html #sel select {
    margin-bottom:5px; /*IE needs this or the bottom border does not render, set to border width*/
    }
    #sel {
    border:5px solid green; /*for all browsers*/
    }
    body>#sel { /*for all except IE, adjust as needed for even appearance*/
    border-top-width:6px;
    border-bottom-width:7px;
    }
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

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