Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why cannot change checkbox color whatever I do? [duplicate]

I try to style checkbox background color, but it won't change whatever I do. I am using firefox 29 latest.

Is there some rule changes in css or may be in the browser?

CSS:

input[type="checkbox"] {     background: #990000;     }  .chk {    background-color: #990000;    } 

Here is a demo http://jsfiddle.net/6KXRg/

like image 858
Ari Avatar asked Jun 20 '14 07:06

Ari


People also ask

How do I change the color of my check box?

“:hover” is used to style the checkbox when user hovers over it. Notice that when the mouse pointer move over the checkbox the color of it changes to yellow. “:active” is used to style the checkbox when it is active. Notice that when click the checkbox it will first notice a red color and then the green color.

How do I change the color of a checkbox in XML?

If you want to change checkbox color then "colorAccent" attribute will use for checked state and "android:textColorSecondary" will use for unchecking state. "actionOverflowButtonStyle" will use for change the color of overflow icon in the Action bar. Same is for refresh button which i am using in my app.


1 Answers

Technically, it is possible to change the color of anything with CSS. As mentioned, you can't change the background-color or color but you can use CSS filters. For example:

input[type="checkbox"] { /* change "blue" browser chrome to yellow */   filter: invert(100%) hue-rotate(18deg) brightness(1.7); } 

If you are really looking for design control over checkboxes though, your best bet is to do the "hidden" checkbox and style an adjacent element such as a div.

like image 77
JP DeVries Avatar answered Sep 22 '22 19:09

JP DeVries