0

we have the following code which is a html5 select dropdown menu:

    <!doctype html>
    <select name="indexCombobox1">
    <option selected value="null">    Sort By:</option>
    <option value="most_recent">    Most Recent</option>
    <option value="most_popular">    Most Popular</option>
    <option value="featured">    Featured</option>
    </select>

is there a data attribute that can set the drop down background transparent so that you can see what's behind the drop down menu? is there a data attribute that changes the option highlight from default blue to a different color, e.g. yellow?

4

2 回答 2

1

CSS(3) should do the trick. Something like:

option:hover {
background-color: rgba(0, 0, 0, .2);
}

Edit: With jquery instead of css:

$('option').hover(function() {
     $(this).css(backgroundColor: 'rgba(0, 0, 0, .2)');
}, function(){
    $(this).css(backgroundColor: 'blue'); //or something else you consider 'normal'
});
于 2012-05-23T07:09:23.827 回答
0

I am increasingly using the jqtransform library to style form elements for both mobile webapps and HTML websites.

I can't confirm if it will enable you to make the background transparent, but it can do just about everything else to form elements.

于 2012-05-23T07:03:48.223 回答