How do I font a DropDownList?

Discussion in 'ASP .Net' started by gnewsgroup, Apr 10, 2008.

  1. gnewsgroup

    gnewsgroup Guest

    I am using Themes for my asp.net 2.0 web application. I am using
    Verdana font (11px) for the entire site, but all DropDownLists seem to
    have Arial, and also a bigger font size (maybe 12px).

    My Default.skin file contains this line:

    <asp:DropDownList runat="server" CssClass="dropdownlist"></
    asp:DropDownList>

    My Default.css contains

    body,td {font-family: Verdana, arial,sans-serif; font-size:11px; }

    So, I thought if I add the following line, it should fix the
    DropDownList font problem:

    dropdownlist {font-family: Verdana, Arial, Sans-Serif; font-size:
    11px;}

    But, it doesn't.

    Someone asked similar question here, but there was no clear answer.

    Any hint? Thanks.
     
    gnewsgroup, Apr 10, 2008
    #1
    1. Advertising

  2. gnewsgroup

    Ujval Shah Guest

    Hi,

    please make class in css file
    ..dropDown
    {
    font-family: verdana;
    font-size: 10px;
    border-width: thin;
    border-style: solid;
    background-color: White;
    border-color: #ffffff;
    color: Black;
    cursor: default;
    }
    so you can use class as <asp:DropDownList runat="server"
    CssClass="dropDown"></asp:DropDownList>
    and it will work..

    "gnewsgroup" wrote:

    > I am using Themes for my asp.net 2.0 web application. I am using
    > Verdana font (11px) for the entire site, but all DropDownLists seem to
    > have Arial, and also a bigger font size (maybe 12px).
    >
    > My Default.skin file contains this line:
    >
    > <asp:DropDownList runat="server" CssClass="dropdownlist"></
    > asp:DropDownList>
    >
    > My Default.css contains
    >
    > body,td {font-family: Verdana, arial,sans-serif; font-size:11px; }
    >
    > So, I thought if I add the following line, it should fix the
    > DropDownList font problem:
    >
    > dropdownlist {font-family: Verdana, Arial, Sans-Serif; font-size:
    > 11px;}
    >
    > But, it doesn't.
    >
    > Someone asked similar question here, but there was no clear answer.
    >
    > Any hint? Thanks.
    >
     
    Ujval Shah, Apr 10, 2008
    #2
    1. Advertising

  3. gnewsgroup

    gnewsgroup Guest

    On Apr 10, 9:47 am, Ujval Shah <>
    wrote:
    > Hi,
    >
    > please make class in css file
    > .dropDown
    > {
    > font-family: verdana;
    > font-size: 10px;
    > border-width: thin;
    > border-style: solid;
    > background-color: White;
    > border-color: #ffffff;
    > color: Black;
    > cursor: default;}
    >
    > so you can use class as <asp:DropDownList runat="server"
    > CssClass="dropDown"></asp:DropDownList>
    > and it will work..
    >


    Thank you. I tried it, but it did not work. Not sure what is going on.
     
    gnewsgroup, Apr 10, 2008
    #3
  4. You can do it by adding
    select {font-family: Verdana, Arial, Sans-Serif; font-size:11px;}

    so you do not need CssClass="dropdownlist"
    <asp:DropDownList runat="server" CssClass="dropdownlist" />


    PS: Should not it be a ".dropdownlist {font-family: Verdana, Arial,
    Sans-Serif; font-size: 11px;}" notice dot in front of dropdown..

    PPS: for some controls in .NET CssClass works a bit differently... It simply
    adds <span class="dropdownlist">

    So your HTML for
    <asp:DropDownList runat="server" CssClass="dropdownlist"></asp:DropDownList>
    Looks like
    <span class="dropdownlist"><select>...</select></span>
    Which is not the same as
    <select class="dropdownlist">

    George

    "gnewsgroup" <> wrote in message
    news:...
    >I am using Themes for my asp.net 2.0 web application. I am using
    > Verdana font (11px) for the entire site, but all DropDownLists seem to
    > have Arial, and also a bigger font size (maybe 12px).
    >
    > My Default.skin file contains this line:
    >
    > <asp:DropDownList runat="server" CssClass="dropdownlist"></
    > asp:DropDownList>
    >
    > My Default.css contains
    >
    > body,td {font-family: Verdana, arial,sans-serif; font-size:11px; }
    >
    > So, I thought if I add the following line, it should fix the
    > DropDownList font problem:
    >
    > dropdownlist {font-family: Verdana, Arial, Sans-Serif; font-size:
    > 11px;}
    >
    > But, it doesn't.
    >
    > Someone asked similar question here, but there was no clear answer.
    >
    > Any hint? Thanks.
     
    George Ter-Saakov, Apr 10, 2008
    #4
  5. gnewsgroup

    David Wier Guest

    This worked fine for me, just copying and pasting - BUT I did need to make
    sure I had the page pointing to my CSS file where I copied this code.
    By using it this way, it only affects the one to which you add the
    'CssClass' attribute.

    By using 'select', it will affect all DropDownLists

    David Wier
    http://aspnet101.com
    http://iWritePro.com - One click PDF, convert .doc/.rtf/.txt to HTML with no
    bloated markup


    "gnewsgroup" <> wrote in message
    news:...
    > On Apr 10, 9:47 am, Ujval Shah <>
    > wrote:
    >> Hi,
    >>
    >> please make class in css file
    >> .dropDown
    >> {
    >> font-family: verdana;
    >> font-size: 10px;
    >> border-width: thin;
    >> border-style: solid;
    >> background-color: White;
    >> border-color: #ffffff;
    >> color: Black;
    >> cursor: default;}
    >>
    >> so you can use class as <asp:DropDownList runat="server"
    >> CssClass="dropDown"></asp:DropDownList>
    >> and it will work..
    >>

    >
    > Thank you. I tried it, but it did not work. Not sure what is going on.
     
    David Wier, Apr 10, 2008
    #5
  6. gnewsgroup

    gnewsgroup Guest

    On Apr 10, 10:38 am, "George Ter-Saakov" <> wrote:
    > You can do it by adding
    > select {font-family: Verdana, Arial, Sans-Serif; font-size:11px;}
    >
    > so you do not need CssClass="dropdownlist"
    > <asp:DropDownList runat="server" CssClass="dropdownlist" />
    >
    > PS: Should not it be a ".dropdownlist {font-family: Verdana, Arial,
    > Sans-Serif; font-size: 11px;}" notice dot in front of dropdown..
    >
    > PPS: for some controls in .NET CssClass works a bit differently... It simply
    > adds <span class="dropdownlist">
    >
    > So your HTML for
    > <asp:DropDownList runat="server" CssClass="dropdownlist"></asp:DropDownList>
    > Looks like
    > <span class="dropdownlist"><select>...</select></span>
    > Which is not the same as
    > <select class="dropdownlist">
    >
    > George
    >


    No wonder it should be select instead of dropdownlist. Now it works.
    That's great. Thank you. So, I guess to font a <asp:TextBox>
    control, I'll have in the skin file something like:

    textbox {font-family: Verdana, Arial, Sans-Serif, font-size: 11px;}

    Right?
     
    gnewsgroup, Apr 10, 2008
    #6
  7. gnewsgroup

    gnewsgroup Guest

    On Apr 10, 10:50 am, "David Wier" <> wrote:
    > This worked fine for me, just copying and pasting - BUT I did need to make
    > sure I had the page pointing to my CSS file where I copied this code.
    > By using it this way, it only affects the one to which you add the
    > 'CssClass' attribute.
    >
    > By using 'select', it will affect all DropDownLists

    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    This is precisely my goal. :)
     
    gnewsgroup, Apr 10, 2008
    #7
  8. Nope, but you got the concept
    the <asp:Textbox...> translates into <input type="text" ... > in HTML

    So it should not be "textbox {font-family: Verdana, Arial, Sans-Serif,
    font-size: 11px;}"

    But "input {font-family: Verdana, Arial, Sans-Serif, font-size: 11px;}" will
    work...


    George.

    "gnewsgroup" <> wrote in message
    news:...
    > On Apr 10, 10:38 am, "George Ter-Saakov" <> wrote:
    >> You can do it by adding
    >> select {font-family: Verdana, Arial, Sans-Serif; font-size:11px;}
    >>
    >> so you do not need CssClass="dropdownlist"
    >> <asp:DropDownList runat="server" CssClass="dropdownlist" />
    >>
    >> PS: Should not it be a ".dropdownlist {font-family: Verdana, Arial,
    >> Sans-Serif; font-size: 11px;}" notice dot in front of dropdown..
    >>
    >> PPS: for some controls in .NET CssClass works a bit differently... It
    >> simply
    >> adds <span class="dropdownlist">
    >>
    >> So your HTML for
    >> <asp:DropDownList runat="server"
    >> CssClass="dropdownlist"></asp:DropDownList>
    >> Looks like
    >> <span class="dropdownlist"><select>...</select></span>
    >> Which is not the same as
    >> <select class="dropdownlist">
    >>
    >> George
    >>

    >
    > No wonder it should be select instead of dropdownlist. Now it works.
    > That's great. Thank you. So, I guess to font a <asp:TextBox>
    > control, I'll have in the skin file something like:
    >
    > textbox {font-family: Verdana, Arial, Sans-Serif, font-size: 11px;}
    >
    > Right?
    >
    >
     
    George Ter-Saakov, Apr 10, 2008
    #8
  9. gnewsgroup

    gnewsgroup Guest

    On Apr 10, 11:44 am, "George Ter-Saakov" <> wrote:
    > Nope, but you got the concept
    > the <asp:Textbox...> translates into <input type="text" ... > in HTML
    >
    > So it should not be "textbox {font-family: Verdana, Arial, Sans-Serif,
    > font-size: 11px;}"
    >
    > But "input {font-family: Verdana, Arial, Sans-Serif, font-size: 11px;}" will
    > work...
    >
    > George.
    >


    Thank you, Goerge.

    Yes, I figured that out by peeking into the HTML.
     
    gnewsgroup, Apr 10, 2008
    #9
  10. PS: Forgot to add that this line "input {font-family: Verdana, Arial,
    Sans-Serif, font-size: 11px;}"
    will change all buttons too not only input boxes...
    Since buttons in HTML are <input type="button"...>

    George.


    "George Ter-Saakov" <> wrote in message
    news:...
    > Nope, but you got the concept
    > the <asp:Textbox...> translates into <input type="text" ... > in HTML
    >
    > So it should not be "textbox {font-family: Verdana, Arial, Sans-Serif,
    > font-size: 11px;}"
    >
    > But "input {font-family: Verdana, Arial, Sans-Serif, font-size: 11px;}"
    > will work...
    >
    >
    > George.
    >
    > "gnewsgroup" <> wrote in message
    > news:...
    >> On Apr 10, 10:38 am, "George Ter-Saakov" <> wrote:
    >>> You can do it by adding
    >>> select {font-family: Verdana, Arial, Sans-Serif; font-size:11px;}
    >>>
    >>> so you do not need CssClass="dropdownlist"
    >>> <asp:DropDownList runat="server" CssClass="dropdownlist" />
    >>>
    >>> PS: Should not it be a ".dropdownlist {font-family: Verdana, Arial,
    >>> Sans-Serif; font-size: 11px;}" notice dot in front of dropdown..
    >>>
    >>> PPS: for some controls in .NET CssClass works a bit differently... It
    >>> simply
    >>> adds <span class="dropdownlist">
    >>>
    >>> So your HTML for
    >>> <asp:DropDownList runat="server"
    >>> CssClass="dropdownlist"></asp:DropDownList>
    >>> Looks like
    >>> <span class="dropdownlist"><select>...</select></span>
    >>> Which is not the same as
    >>> <select class="dropdownlist">
    >>>
    >>> George
    >>>

    >>
    >> No wonder it should be select instead of dropdownlist. Now it works.
    >> That's great. Thank you. So, I guess to font a <asp:TextBox>
    >> control, I'll have in the skin file something like:
    >>
    >> textbox {font-family: Verdana, Arial, Sans-Serif, font-size: 11px;}
    >>
    >> Right?
    >>
    >>

    >
    >
     
    George Ter-Saakov, Apr 10, 2008
    #10
  11. gnewsgroup

    gnewsgroup Guest

    On Apr 10, 11:54 am, "George Ter-Saakov" <> wrote:
    > PS: Forgot to add that this line "input {font-family: Verdana, Arial,
    > Sans-Serif, font-size: 11px;}"
    > will change all buttons too not only input boxes...
    > Since buttons in HTML are <input type="button"...>
    >
    > George.
    >


    That's turns out to be fantastic, since I like to be consistent
    anyway. I don't like to use all kinds of font flavors in my web
    application. Unless there is a very special reason, I stick to one
    font.
     
    gnewsgroup, Apr 10, 2008
    #11
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Karl Hungus

    Font class, external font files question

    Karl Hungus, Feb 4, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    559
    Karl Hungus
    Feb 4, 2004
  2. =?Utf-8?B?Tmlja3k=?=
    Replies:
    2
    Views:
    730
    Matt Berther
    Feb 20, 2005
  3. Michael Glavitsch
    Replies:
    1
    Views:
    791
    Roedy Green
    Jul 15, 2003
  4. Nick Spinel
    Replies:
    0
    Views:
    961
    Nick Spinel
    Jul 25, 2003
  5. mttc
    Replies:
    2
    Views:
    2,450
    Roedy Green
    Jul 3, 2009
Loading...

Share This Page