Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,845 questions

51,766 answers

573 users

How to change the select option HTML tag background color with CSS

3 Answers

0 votes
<!DOCTYPE html>
<html>
    <head>
        <style type="text/css">
            select option {
                background: rgba(255,0,0,0.3);
            }
        </style>
    </head>
    <body>
        <select name="gender">
            <option style="color:gray" value="iam">I am</option>
            <option value="female">Female</option>
            <option value="male">Male</option>
        </select>
    </body>
</html>

 



answered Dec 27, 2015 by avibootz
edited Dec 27, 2015 by avibootz
0 votes
<!DOCTYPE html>
<html>
    <head>
        <style type="text/css">
            select option {
                background-color: rgba(0,0,255,0.3);
            }
        </style>
    </head>
    <body>
        <select name="gender">
            <option style="color:gray" value="iam">I am</option>
            <option value="female">Female</option>
            <option value="male">Male</option>
        </select>
    </body>
</html>

 



answered Dec 27, 2015 by avibootz
edited Dec 27, 2015 by avibootz
0 votes
<!DOCTYPE html>
<html>
    <head>
        <style type="text/css">
            select option {
                background-color: rgba(255,0,0,0.3);
            }
        </style>

        <style type="text/css">
            .numbers option {
                background-color: rgba(0,0,255,0.3);
            }
        </style>
    </head>
    <body>
        <select name="gender">
            <option style="color:gray" value="iam">I am</option>
            <option value="female">Female</option>
            <option value="male">Male</option>
        </select>
        <select>
            <optgroup label="Numbers" class="numbers">
                <option style="color:gray" value="0">Zero</option>
                <option value="1">One</option>
                <option value="2">Two</option>
            </optgroup>
        </select>
    </body>
</html>

 



answered Dec 27, 2015 by avibootz

Related questions

3 answers 369 views
1 answer 261 views
1 answer 251 views
1 answer 243 views
1 answer 258 views
2 answers 314 views
1 answer 260 views
...