473,466 Members | 1,397 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

style select tag

Hi,
is it possible to style the elements from an dropdownmenue <select>
<option></option> </select> tag ?
Thanks for any help.
Rolf
Jul 20 '05 #1
9 82057
Rolf Brauser schreef:
Hi,
is it possible to style the elements from an dropdownmenue <select>
<option></option> </select> tag ?


Yes.
<head>
<style type="text/css">
<!--
..listheader {
color: #FFFFFF;
background: #000000;
}
..listdata {
color: #000000;
background: #FFFF66;
}
-->
</style>
</head>
<body>
<form action="" method="get">
<select>
<option selected>Beers of the World</option>
<option class="listheader">Campbelltown</option>
<option class="listdata"> - Springbank 21 yr.</option>
<option class="listdata"> - Springbank 15 yr.</option>
<option class="listdata"> - Springbank 12 yr. </option>
<option class="listdata"> - Glen Scotia </option>
<option class="listheader">Highland</option>
<option class="listdata"> - Royal Lochnager Selected Reserve </option>
<option class="listdata"> - Oban 14 yr. </option>
<option class="listdata"> - Lock Dhu Black 10 yr. </option>
<option class="listdata"> - Highland Park 12 yr.</option>
<option class="listdata"> - Glenmorangie 1971 Vintage. </option>
</select>
</form>
</body>
--
Edwin van der Vaart
http://www.semi-conductor.nl/ Links to Semiconductors sites
http://www.evandervaart.nl/ Under construction
Jul 20 '05 #2
> Yes.
<head>
<style type="text/css">
<!--
.listheader {
color: #FFFFFF;
background: #000000;
}
.listdata {
color: #000000;
background: #FFFF66;
}


Hi Edwin,
Thanks that rocks nice, but isnt exactly what I meant. Is it also possible
to color the border, the arrow, and the other scrollbar elements?
Rolf

Jul 20 '05 #3
On Tue, 5 Oct 2004 17:39:06 +0200, Rolf Brauser <fa******@a1.net> wrote:
Yes.
<head>
<style type="text/css">
<!--
.listheader {
color: #FFFFFF;
background: #000000;
}
.listdata {
color: #000000;
background: #FFFF66;
}


Hi Edwin,
Thanks that rocks nice, but isnt exactly what I meant. Is it also
possible
to color the border, the arrow, and the other scrollbar elements?
Rolf


Those are part of the OS and aren't really smart to mess with even where
you can. Some studies have shown decreased usability when these arenm't
easily recognized.
Jul 20 '05 #4
Edwin van der Vaart <pi************@yahoo.co.uk>:
.listheader {
color: #FFFFFF;
background: #000000;
}
.listdata {
color: #000000;
background: #FFFF66; <select>
<option selected>Beers of the World</option>
<option class="listheader">Campbelltown</option>
<option class="listdata"> - Springbank 21 yr.</option>
<option class="listdata"> - Springbank 15 yr.</option>
<option class="listdata"> - Springbank 12 yr. </option>
<option class="listdata"> - Glen Scotia </option>
<option class="listheader">Highland</option>
<option class="listdata"> - Royal Lochnager Selected Reserve </option>
<option class="listdata"> - Oban 14 yr. </option>
<option class="listdata"> - Lock Dhu Black 10 yr. </option>
<option class="listdata"> - Highland Park 12 yr.</option>
<option class="listdata"> - Glenmorangie 1971 Vintage. </option>
</select>


Eek! More like:

optgroup {
color: #FFF;
background: #000;
}
option {
color: #000;
background: #FF6;
}

<fieldset><legend>Beers of the World</legend><select multiple>
<optgroup label="Campbelltown">
<option value="sb21">Springbank 21 yr.</option>
<option value="sb15">Springbank 15 yr.</option>
<option value="sb12">Springbank 12 yr.</option>
<option value="glsc">Glen Scotia</option>
</optgroup>
<optgroup label="Highland">
<option value="rlsr">Royal Lochnager Selected Reserve</option>
<option value="ob14">Oban 14 yr.</option>
<option value="ldb10">Lock Dhu Black 10 yr.</option>
<option value="hp12">Highland Park 12 yr.</option>
<option value="gm71">Glenmorangie 1971 Vintage.</option>
</optgroup>
</fieldset></select>

Of course CSS conforming UAs do not have to style form widgets and some
indeed choose not to or only to a certain degree.

P.S.: 21-year-old beer?

--
No sig today, my .sig has gone away
The divider stands forlorn, a symbol of the dawn
No sig today, it seems a common sight
But people reading by don't know the reason why
Jul 20 '05 #5
Christoph Paeper schreef:

[snip some css and html code]
Eek! More like:

[snip corrected css and html code]
Thanx for correcting them.
I was in a bit hurry.
Of course CSS conforming UAs do not have to style form widgets and some
indeed choose not to or only to a certain degree.

P.S.: 21-year-old beer?


Heee.
It was an example from a cd of Dreamweaver MX 2004 Bible :-P
--
Edwin van der Vaart
http://www.semi-conductor.nl/ Links to Semiconductors sites
http://www.evandervaart.nl/ Under construction
Jul 20 '05 #6
Those are part of the OS and aren't really smart to mess with even where
you can. Some studies have shown decreased usability when these arenm't
easily recognized.


I wont put a white font on a white background. It depends on how u design
things.
Jul 20 '05 #7
On Wed, 6 Oct 2004 14:43:02 +0200, Rolf Brauser <fa******@a1.net> wrote:
Those are part of the OS and aren't really smart to mess with even where
you can. Some studies have shown decreased usability when these arenm't
easily recognized.
I wont put a white font on a white background.


Interesting. You understand the color contrast will be... insufficiently
readable?
It depends on how u design
things.


Perhaps we need to see a sample of what you intend, and post a URP to the
uploaded example. Because in my experience, what you're after is at best
unnecessary and at worst disasterous.
Jul 20 '05 #8
On Wed, 6 Oct 2004 14:43:02 +0200, Rolf Brauser wrote:
I wont put a white font on a white background.


Does that mean..
a) I want to put.. (wont -> want)
b) I will not put.. (wont -> won't -> will not)

--
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.lensescapes.com/ Images that escape the mundane
Jul 20 '05 #9
On Wed, 06 Oct 2004 13:24:23 GMT, Andrew Thompson <Se********@www.invalid>
wrote:
On Wed, 6 Oct 2004 14:43:02 +0200, Rolf Brauser wrote:
I wont put a white font on a white background.


Does that mean..
a) I want to put.. (wont -> want)
b) I will not put.. (wont -> won't -> will not)


Good eye - my response was predicated on "want to".
Jul 20 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Andrus | last post by:
I want that if user clicks in a checkbox, the strike-through effect applices to current table row. I tried the following code in IE, but nothing happens. Any idea ? <table> <tr><td><input...
4
by: Jeff Anderson | last post by:
Is there a style for a select option's "selected" color? For example: <HTML> <BODY> <FORM NAME="form1"> <SELECT NAME="mySelect" SIZE="7" style="background-color:red;"> <OPTION>Test 1...
5
by: Jeremy | last post by:
Apologies if the terminology isn't quite right here... say we have the following code: <SELECT NAME="p1_val" class=list-element> If the class "list-element" isn't defined, is it possible...
9
by: netclectic | last post by:
I'm dynamically adding options to a select list in javascript and i need to be able to set the height of the option, but setting style.height has not effect, I also tried style.pixelHeight but no...
5
by: Ben | last post by:
I have a form for data entry which is in a table. I have a select box to enter a customer name, which takes it's options from the customer database. I have a button to add a new customer. What I...
5
by: johnsuth | last post by:
I want to produce a trivial demonstration of dynamic modification. I thought that pressing a button might change its color. I studied O'Reillys books and successfully created the button with a...
5
by: Isha | last post by:
Hi all, I wanted to change the background color for only the first option in a select box, but following changed the background color for the whole dropdown box. <select name="alltags"...
1
by: John Devlon | last post by:
Hi, Does anyone know how to apply a style rule to controle? Where can i select de style role after the file has been linked to the page ? I can do it by code but is there a window that shows...
2
by: plsHelpMe | last post by:
Hi All, I am facing a weired issue. I am having a search form with some of the fields on it and a button which submits these fields values. Functionaly everything is working fine but sometimes...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.