How to add an specific css class to NativeSelect

Hi!

We are working in a project using Vaadin 6.8.12 version. We have to customize some elements like NativeSelects, adding some CSS styles in order to get our desired Look & Feel.

However, if we add the style by the use of “nativeSelect.setStyleName(“class-name”);”, the style is added to “div” element which covers NativeSelect. We are interested on put the style in the input element, not in its parent div.

Is there any option to solve our problem?

Thanks in advance!

Using only the core facilities, I’m afraid it’s not directly possible. You’d have to extend the VNativeSelect widget and add the custom stylenames (in Vaadin 7, for what it’s worth, this would be quite easy using an Extension). However, is there a reason you can’t simply write your CSS rules like this:

.v-select.my-style-name select {
    ...
}

How to resize nativeselect width and height