Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS CSS Selectors Going Further with Attribute Selectors and Pseudo-Classes Element States Pseudo-Classes

Emmanuel Rojas
Emmanuel Rojas
6,994 Points

How Can I add any color to the check box after it is checked

How Can I add any color to the check box after it is checked. I was trying like this, but it do not work. Help!! pleace.

input[type="checkbox"]:checked { color: blue; }

1 Answer

Steven Parker
Steven Parker
231,236 Points

:point_right: Checkboxes and radio buttons don't have a color property, so they cannot be given a color that way.

A cute trick used by some of the popular CSS frameworks is to hide or cover the actual checkbox, and then trigger it with an associated label which is given a custom image. You can use this trick to just add color, or you could give your checkbox a radically different appearance.

:information_source: There are several websites that offer helper code for setting up these things. One of them is CSS Checkbox.