Jump to content

Set the Background and Text Color of the <optgroup> Element in Firefox


iwato

Recommended Posts

BACKGROUND:  Please compare the Select Language <select> element option menu under the headings Free Webinar and Newsletter/Subscribe found in the navigation bar on the Grammar Captive main page.  Therein lies the heart of the following question. 

QUESTION:  How does one set the background and text colors of the <optgroup> element so that they appear properly in Firefox?

Neither

optgroup {
	background: black;
	color: white;
}

nor

optgroup {
	background-color: black;
	color: white;
}

appear to work.

Roddy

Link to comment
Share on other sites

The styling of form elements is very restricted. You can read more about it here: https://developer.mozilla.org/en-US/docs/Learn/HTML/Forms/Styling_HTML_forms

You can't style optgroup elements. If it's very important to give style to a structure similar to that one you'll have to create your own imitation of a dropdown using Javascript.

  • Like 1
Link to comment
Share on other sites

Yeah, i discovered that Firefox has the element locked. Does this mean that I have to reformat the background color in order to get the element to perform?  The text is simply impossible to read.

Roddy

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...