Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Jan 2011
    Posts
    42
    Thanks
    1
    Thanked 0 Times in 0 Posts

    font-family for dropdown list

    Hi,

    I would like to change the font-family for the entries (Test1, Test2) in the dropdown list to arial as below:

    <select>
    <option >Test1</option>
    <option >Test2</option>
    </select>

    I modified it as:

    <select>
    <option style="font-family: arial">Test1</option>
    <option style="font-family: arial">Test2</option>
    </select>

    But this doesn't work. Can you please let me know how i can resolve this.

    Thanks.

  • #2
    Regular Coder Nile's Avatar
    Join Date
    Jun 2008
    Posts
    280
    Thanks
    2
    Thanked 46 Times in 46 Posts
    Try doing it with CSS:
    Code:
    <style type="text/css">
    select option { font-family: arial; }
    </style>

  • #3
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,746
    Thanks
    22
    Thanked 1,838 Times in 1,822 Posts
    Hello htmlster,
    But this doesn't work. Can you please let me know how i can resolve this.
    I think it should work though, which makes me thing you have something overriding it. Do you have something in your CSS specifying a different font with !important on it?

    Give us a link to the test site to look for it.
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

  • #4
    New Coder
    Join Date
    Jan 2011
    Posts
    42
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Exactly. I have another select which is overiding my class.

    Now i'm able to see the font-family properly.

    i have .select {font-family: verdana}; changed this and it worked. Thanks for your suggestion.


  •  

    Posting Permissions

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