473,785 Members | 2,219 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Display CSS in Drop Down

I'm trying to display a small "color square" to the left of each combo box
choice. I know I can make each choice have a different background color, but
is it possible to display a background image for each row? In my code below,
I'm trying to display img_color1.gif which is a 5 pixel wide by 10 pixel
high transparent gif with a small color square on the background of a
choice.

My end goal is to have an Outlook looking combo box like the "LABEL" option
on outlook 2003's calendar event.

<style>
.cboColor1 {
background: url('http://www.mileslumber .net/images/img_color1.gif' )
no-repeat;
}
.cboColor2 {
background: url(http://www.mileslumber.net/images/img_color1.gif) right
top
}
.cboColor3 {
list-style-type: disc; color:#3A3E59
}
</style>

' HTML Combo below

<select size="1" name="cboColors ">
<option value="1">Choic e 1</option>
<option value="2" style="backgrou nd-color:blue; color:white">Ch oice
2</option>
<option value="3" class="cboColor 1">Choice 3</option>
<option value="4" class="cboColor 2">Choice 4</option>
<option value="5" style="backgrou nd:
url('http://www.myweb.com/images/img_color1.gif' ) no-repeat;
color:white">Ch oice 5</option>
<option value="6" class="cboColor 3">Choice 6</option>
Jul 22 '05 #1
5 1524
Gazing into my crystal ball I observed "scott" <sb*****@milesl umber.com>
writing in news:#g******** ******@TK2MSFTN GP09.phx.gbl:
I'm trying to display a small "color square" to the left of each combo
box choice. I know I can make each choice have a different background
color, but is it possible to display a background image for each row?


No. Color is possible for some browsers, but a background image is not.
Nesting an img element in the option element is not will not work either.
--
Adrienne Boswell
http://www.cavalcade-of-coding.info
Please respond to the group so others can share
Jul 22 '05 #2
Adrienne wrote:
I'm trying to display a small "color square" to the left of each
combo box choice. I know I can make each choice have a different
background color, but is it possible to display a background image
for each row?


No. Color is possible for some browsers, but a background image is
not. Nesting an img element in the option element is not will not
work either.


I'm not sure I agree. YOUR FAVORITE browser may not support it. But if the
browser offers full CSS2 support, a background image should be allowed on
option elements:

'background-image'
Value: <uri> | none | inherit
Initial: none
===> Applies to: all elements
Inherited: no
Percentages: N/A
Media: visual
Computed value: absolute URI

http://www.w3.org/TR/CSS21/colors.ht...ckground-image
--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Jul 22 '05 #3
Gazing into my crystal ball I observed "Dave Anderson"
<GT**********@s pammotel.com> writing in
news:#x******** *****@TK2MSFTNG P12.phx.gbl:
Adrienne wrote:
I'm trying to display a small "color square" to the left of each
combo box choice. I know I can make each choice have a different
background color, but is it possible to display a background image
for each row?


No. Color is possible for some browsers, but a background image is
not. Nesting an img element in the option element is not will not work
either.


I'm not sure I agree. YOUR FAVORITE browser may not support it. But if
the browser offers full CSS2 support, a background image should be
allowed on option elements:

'background-image'
Value: <uri> | none | inherit
Initial: none
===> Applies to: all elements
Inherited: no
Percentages: N/A
Media: visual
Computed value: absolute URI

http://www.w3.org/TR/CSS21/colors.ht...ckground-image


My favorite browsers are Opera 8 and Firefox 1.0, which both support CSS2
(IIRC FF supports some CSS3), but I could not get a background image to
show in either of those browsers, nor IE. I would imagine the browsers do
not support it perhaps because of having to draw the images and the height
of the option element. What would a browser do with an image that was
100px high? Cut if off, expand the option element's height? With color,
there is nothing to draw, really.

--
Adrienne Boswell
http://www.cavalcade-of-coding.info
Please respond to the group so others can share
Jul 22 '05 #4
Adrienne wrote:
But if the browser offers full CSS2 support, a background image
should be allowed on option elements:
My favorite browsers are Opera 8 and Firefox 1.0, which both support
CSS2 (IIRC FF supports some CSS3), but I could not get a background
image to show in either of those browsers, nor IE.


I don't think anyone makes the claim that Firefox has FULL CSS2 support.
Opera claims "In compliance with W3C standards," but does make specific
conformance claims. Perhaps Opera distinguishes between W3C Recommendations
and Specifications. ..

What would a browser do with an image that was 100px high? Cut
if off, expand the option element's height? With color, there
is nothing to draw, really.


The default display behavior would be in effect. What does the browser do
for any other element with a background image? Put another way, why do you
suppose there are style attributes background-repeat and
background-position?
--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Jul 22 '05 #5
i tried every way, no dice on drop-down.
"Dave Anderson" <GT**********@s pammotel.com> wrote in message
news:ed******** ******@TK2MSFTN GP10.phx.gbl...
Adrienne wrote:
But if the browser offers full CSS2 support, a background image
should be allowed on option elements:


My favorite browsers are Opera 8 and Firefox 1.0, which both support
CSS2 (IIRC FF supports some CSS3), but I could not get a background
image to show in either of those browsers, nor IE.


I don't think anyone makes the claim that Firefox has FULL CSS2 support.
Opera claims "In compliance with W3C standards," but does make specific
conformance claims. Perhaps Opera distinguishes between W3C
Recommendations and Specifications. ..

What would a browser do with an image that was 100px high? Cut
if off, expand the option element's height? With color, there
is nothing to draw, really.


The default display behavior would be in effect. What does the browser do
for any other element with a background image? Put another way, why do you
suppose there are style attributes background-repeat and
background-position?
--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message.
Use of this email address implies consent to these terms. Please do not
contact me directly or ask me to contact you directly for assistance. If
your question is worth asking, it's worth posting.

Jul 22 '05 #6

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

Similar topics

4
1569
by: Marcia | last post by:
Hello. I have just enrolled in a Visual Basic class, so please forgive this very basic question about the display environment of the VB Editor.... The illustrations in my textbook indicate that they can choose the form that they have created in the Class View and, to the right of that, they can choose one or more **specifically-named** event procedure(s) that they have written for various objects (ie., btnPush_Click).
1
2321
by: fleemo17 | last post by:
For increased accessibility, I've replaced "display:none" with the Off-Left method of hiding my CSS drop-down menus because the Jaws screen reader doesn't see any of the menus hidden with "display:none". The Off-Left method (placing elements way over to the left beyond the browser window) seems to work well in everything except IE 6 for the PC, where it displays the drop-downs about an inch to the right of where they should be. (View...
5
2420
by: Elvis V. | last post by:
Good morning, I have a table with three fields, Buildings, Floors and Rooms. This is what I would like to do; in my form when I select Building1 in my drop down box for Buildings, when I go to the next drop down field which is Floors, all I would like to see is just the floors that belong to Building1 only and then once I have selected a value for Floors, when I go to the next drop down field which is Rooms, all I want to see are the...
1
1436
by: Cleus | last post by:
Is there a way to display read only values in a drop down listbox? Below is an example of what I need displayed in the drop down list. The users should only be able to select Item 1-9. Category A-C are just for display/clarification purposes. Category A Item 1 Item 2 Item 3 Category B
3
2479
by: pmud | last post by:
Hi, I have a drop down list bound to a database thorugh a data reader. It reads the customer names from data reader. Now, I want the user to be able to type more than one alphabet & the list becomes shorter & shorter for the user to choose a value from. For example, suppose the user wants to select the name "Michael" from the dop down list . So when he tabs over & reaches this drop down list, he types "Mi" , then all the names...
4
2739
by: rszebras | last post by:
I inherited a database (as a novice at Access) and need to modify it to make it more efficient, i.e., the assignment form needs to autopopulate with the client's name, address, phone number, etc., when you select the cust id. Found this cited as a good method: http://www.mvps.org/access/forms/frm0058.htm I have two tables (clients, assignments) and one form (assignment input) in the database. I have a control box called CUST ID in the...
1
1759
by: tsunethere | last post by:
hi.. I wana search records from csv file by using perl and by calling this perl file in cgi . display this value searched from csv file into drop down list of HTML form. the code I need to write in CGI. i.e take 1st drop-down list value from HTML form and display in 2nd drop-down list of HTML. How do I code this? if anybody can guide, plz guide.
2
3095
by: giandeo | last post by:
Hello all, It's almost a couple of weeks since i am struggling to get this code work. Unfortunately, i am stuck. There seems to be no hope... Please Help....... I am working with an asp page that dynamically pulls info from my database to populate a drop down menu. Upon an onChange event, I wish to display the fields related to that pull down menu WITHOUT SUBMITTING THE PAGE. The Senario: Database name: sp.mdb
6
4815
by: dkyadav80 | last post by:
Hi sir, I'm new about xml, javascript. I have two selection field(html) first is city and second is state. the city and state values should be store in xml file. when user select city then all city values should display in city selection field and when user select any one city value then this state of this city should be display auto in state selection field without user selection. please solve my prolem. Thank you.
0
9646
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9483
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10346
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10096
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9956
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6742
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5514
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3658
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2887
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.