NativeSelect background color

Hi,

How can I set a background color of a nativeselect?

Br,
Xuan

Code:
NativeSelect sel = new NativeSelect ();
sel.addStyleName(“myStyle”);

Css:
.v-select-select-myStyle{
background-color: #E0E0F0;
}

What I’ve tested, it should work exactly like that.

On a side note: Remember that NativeSelect is truly native, as in, it will look different depending of the OS of the user. Because of that reason theming will not look exactly the same on every computer.

Strange, it does not work on my machine!

I tried following code, it works, but if i use stylename, it does not work? How come?

code:
NativeSelect sel = new NativeSelect();

css:
.v-select-select{
background-color: #E0E0F0;
}

Use something like firefox firebug, chrome inspector or internet explorer developer tools to look which class name it gives to the select to be certain that your css matches it.

The selector is invalid. Should be for example

.v-select-myStyle select {

}

Thanks, this one works!

Besides reading html source code, is there any other way to find the class name used by a control? We are in a place where only IE allowed and no way to install any extra software. It helps a lot if we can read the source code.

Br,
Xuan

IE8 and later come with developer tools that you can open with F12 or from the menu - see
here
for more information.

Older versions do require plugins for this.

Brilliant! We will upgrade to IE 8 soon.