G'day
I would like to be able to give a different style to *part* of an option field within a form. I cannot seem to find any reference to whether the following is possible: <option value="something">Name <span>(with photo)</span></option> Ideally the words within the <span> tags would be styled differently to those outside. Can anyone shed any light on this please?
From the spec:
<!ELEMENT option (#PCDATA)> <!-- selectable choice -->
My understanding of this is that the option element can only contain text, not other elements. Try validating a document with the <option> as you wrote it.
Even if it was allowed, you might run unto trouble - formatting of form elements is operating system (and perhaps browser) dependent. Some styling might work in some browsers on some platforms but have no effect in others (or worse).
You might try changing the background color on selected options (via a class) instead - this seems to work in some browsers.
option.photo { background-color:red;color:white }Regards -- Bert Doorn, Better Web Design http://www.betterwebdesign.com.au/ Fast-loading, user-friendly websites
****************************************************** The discussion list for http://webstandardsgroup.org/
See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list & getting help ******************************************************
