WEB Custom bg and text color in select menu

Discussion in 'OT Technology' started by brds, Nov 5, 2009.

  1. brds

    brds OT Supporter

    Joined:
    Jun 26, 2006
    Messages:
    17,652
    Likes Received:
    15
    Location:
    Atlanta
    I'm trying to create a select menu with a light green background (#f3fae2) and a text color of (#99c23a). I have the following code:

    CSS Def.
    Code:
    option.green
    {
        border:none;
        background-color:#f3fae2;
        color:#99c23a;
    }
    
    Usage:
    Code:
    $categories = $connection->runQuery("SELECT * FROM TABLE_NAME ORDER BY catName;");
    
    echo "<select name='appcategory'>
              <option value='empty' class='green'>&nbsp;</option>";
              foreach ($categories as $thiscat)
                   echo "<option value='" . $thiscat['genreID'] . "' class='green'>" . $thiscat['genreName'] . "</option>";
    echo "</select>";
    
    This is only kinda working. When the page loads, the drop down that shows up is white (with no text in it). Only when i click the dropdown button do the categories show up with a correct bg and text color. Here's a screen shot of when the page loads, and when the user drops the options down.

    Page load:
    [​IMG]


    Drop down options:
    [​IMG]

    Is there any way to make the page load box have a background color? Also, is there any way i can change the highlight color, or have the border go away?
     
  2. Coaxsist

    Coaxsist Re-create... Innovate

    Joined:
    Feb 11, 2008
    Messages:
    1,032
    Likes Received:
    0
    That is indeed confusing. I wish I could help but I don't know the language your using. PHP?
     
  3. Insert Tokens

    Insert Tokens Making Cancer My Bitch OT Supporter

    Joined:
    Jan 12, 2006
    Messages:
    8,330
    Likes Received:
    76
    Location:
    Tasmania
    Set the background colour on the 'select' tag instead of on the 'option' tag?

    Can't test for you atm, but seems like it'd work..
     
  4. Ricky

    Ricky █▄ █▄█ █▄ ▀█▄

    Joined:
    Jun 17, 2005
    Messages:
    38,766
    Likes Received:
    6
    Last edited: Nov 7, 2009

Share This Page