Hero Stripe
Hero Stripe

Reputation: 89

Background color of checkbox and selection in css

I want to change background color of my check-box and i can't

here is my code :

<input type="checkbox" class="color"/>

and css

.color{

    backgoround-color:red;
}

Where is my error :/ And also i want to change the selection style Terminal

I tried like below:

<select class="cls">
        <option>Terminal</option>
    </select>
<div class="cls">
<select>
        <option>Terminal</option>
    </select>
</div>

Doesn't work!

Upvotes: 0

Views: 1014

Answers (3)

Samih
Samih

Reputation: 1098

Even with the above typos fixed I don't think checkbox can accept a background-color (doesn't work in chrome for me right now).

You will have to use a custom checkbox image to set a background color on one. I have used this technique successfully before: http://css-tricks.com/snippets/css/custom-checkboxes-and-radio-buttons/ .

Upvotes: 1

Assios
Assios

Reputation: 126

You wrote "background" wrong. It should work when you correct it to

.color{
    background-color:red;
}

Upvotes: 2

Kevin Bowersox
Kevin Bowersox

Reputation: 94499

There is a spelling error in the property name:

background-color:red; /* Instead of backgoround-color:red; */

There is also another spelling error on the select tag:

<select class="cls"> <!-- Instead of <select calss="cls"> -->

Upvotes: 2

Related Questions