0

I am working on a form in which I want to change the color of an input checkbox in css. Here is the fiddle for that. The snippets of HTML code which I have used in order to make a checkbox is:

<div class="form-check mb-3">
   <input class="form-check-input" type="checkbox" id="gridCheck">
   <label class="form-check-label" for="gridCheck">
   Lorem Ipsum is simply dummy text of the printing and typesetting industry.
   </label>
</div>

Problem Statement:

I am wondering what CSS codes I need to add so that I get different checkbox color on select.

I tried with the following css code but it doesn't seem to work:

input#gridCheck.form-check-input
{
color: red;
}
flash
  • 1,455
  • 11
  • 61
  • 132
  • you want to change the colour of the text next to the checkbox ? – ThS Aug 21 '18 at 18:41
  • When we select the checkbox, it appears to be blue. Is there any way we can change that to any other color ? – flash Aug 21 '18 at 18:43
  • I'm using my mobile phone right now I can't see where is that 'blue' color. Would you mind provide a screenshot ? – ThS Aug 21 '18 at 18:49
  • You can't style inputs. By the way, your fiddle uses duplicate IDs. Don't. – Mr Lister Aug 21 '18 at 18:49
  • Duplicate of https://stackoverflow.com/questions/24322599/css-why-cannot-change-checkbox-color-whatever-i-do – Tim Klein Aug 21 '18 at 18:50
  • @MrLister I have used bootstrap to make that form so its all coming from the bootstrap documentation. – flash Aug 21 '18 at 18:50
  • @ths So on select of a checkbox, I can see blue color inside and around the checkbox. Is there any way we can change that ? – flash Aug 21 '18 at 18:52
  • No, that's a default behaviour, you can hide the checkbox and create custom checkbox by adding some additional markup alongside with some `CSS`. As [this](https://www.jqueryscript.net/images/jQuery-Plugin-For-Sliding-Toggle-Switches-LC-Switch.jpg) maybe. – ThS Aug 21 '18 at 18:58
  • Possible duplicate of [How to style a checkbox using CSS?](https://stackoverflow.com/questions/4148499/how-to-style-a-checkbox-using-css) – Evochrome Aug 21 '18 at 18:59
  • Possible duplicate of [css - Why Cannot Change Checkbox Color Whatever I Do?](https://stackoverflow.com/questions/24322599/css-why-cannot-change-checkbox-color-whatever-i-do) – Maximilian Ballard Aug 21 '18 at 19:02

0 Answers0