Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / April 2008

Tip: Looking for answers? Try searching our database.

How do I font a DropDownList?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
gnewsgroup - 10 Apr 2008 14:27 GMT
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 - 10 Apr 2008 14:47 GMT
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..

> 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
[quoted text clipped - 20 lines]
>
> Any hint?  Thanks.
gnewsgroup - 10 Apr 2008 15:11 GMT
On Apr 10, 9:47 am, Ujval Shah <UjvalS...@discussions.microsoft.com>
wrote:
> Hi,
>
[quoted text clipped - 13 lines]
> 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 - 10 Apr 2008 15:50 GMT
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

> On Apr 10, 9:47 am, Ujval Shah <UjvalS...@discussions.microsoft.com>
> wrote:
[quoted text clipped - 17 lines]
>
> Thank you. I tried it, but it did not work. Not sure what is going on.
gnewsgroup - 10 Apr 2008 16:02 GMT
> 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. :-)
George Ter-Saakov - 10 Apr 2008 15:38 GMT
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

>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
[quoted text clipped - 20 lines]
>
> Any hint?  Thanks.
gnewsgroup - 10 Apr 2008 16:01 GMT
> You can do it by adding
> select {font-family: Verdana, Arial, Sans-Serif; font-size:11px;}
[quoted text clipped - 16 lines]
>
> 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 - 10 Apr 2008 16:44 GMT
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.

>> You can do it by adding
>> select {font-family: Verdana, Arial, Sans-Serif; font-size:11px;}
[quoted text clipped - 26 lines]
>
> Right?
gnewsgroup - 10 Apr 2008 16:52 GMT
> Nope, but you got the concept
> the <asp:Textbox...> translates into <input type="text" ... > in HTML
[quoted text clipped - 6 lines]
>
> George.

Thank you, Goerge.

Yes, I figured that out by peeking into the HTML.
George Ter-Saakov - 10 Apr 2008 16:54 GMT
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.

> Nope, but you got the concept
> the <asp:Textbox...> translates into <input type="text" ... > in HTML
[quoted text clipped - 37 lines]
>>
>> Right?
gnewsgroup - 10 Apr 2008 17:06 GMT
> 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.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.