kumar
kumar

Reputation: 1127

Background image for drop down box

Is it Possible to keep the background-image for drop down box using CSS.

For Textbox is getting correctly.

can anybody give sample example

Upvotes: 1

Views: 3012

Answers (1)

Elzo Valugi
Elzo Valugi

Reputation: 27866

Yes is possible. You can style the elements not the select box, as the select box gives only the line when you selected something.

try this css:

<style>
    .green { background:green}
    .red { background:red}
    .blue{background:blue}
</style>

and this html:

<form>
    <select class='green'>
        <option class='red'>A</option>
        <option class='blue'>B</option>
    </select>
</form>

You will see that the main line is green and the options are colored each one to its colour. You can also attach images to the background for each css class.

Upvotes: 3

Related Questions