Skip Navigation

[Resolved] Checkbox checked background-color doesn’t work

This thread is resolved. Here is a description of the problem and solution.

Problem:

Customize checkboxes input box background color.

Solution:

You can try other custom CSS codes, for example:

https://stackoverflow.com/questions/24322599/why-cannot-change-checkbox-color-whatever-i-do/#answer-63513086

Relevant Documentation:

This support ticket is created 3 years, 4 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 7 replies, has 2 voices.

Last updated by kristenM 3 years, 4 months ago.

Assisted by: Luo Yang.

Author
Posts
#2129221

Hi Support.

I'm working on styling checkboxes in views on this page: hidden link
using this guide from Toolset: https://toolset.com/forums/topic/checkbox-css-checked-label-not-working/

Unfortunately it doesn't work and changes the background-color from blue to orange

I've used this CSS in custom css:

div input[type=checkbox] {
height: 25px;
width: 25px;
background-color: #eee;
margin-right:15px;
}

div input[type=checkbox]:checked + label:after {
background-color: #ef495d!important;
}

Is there anything I have misunderstood?

Kind regards

Kristen

#2129527

Hello,

Since it is a custom codes problem, please provide a test site with the same problem, also point out the problem page URLs, I need to test and debug it in a live website, thanks

#2131163
view-css.JPG

I have done below modifications in your website:
Edit page "Nordic Startups Database":
hidden link
Find and select view block "Nordic Startups", in section "Custom JS and CSS", add below CSS codes:

div.checkbox label {
  background-color: green;
}

See my screenshot view-css.JPG

It works fine in front-end:
hidden link

It is only a demo for your reference, you need to customize the CSS codes according to what you want.

#2131791
checkbox color.jpg

Hi Luo Chang.

Thank you for your input. I now found a new way to get css in to Toolset 🙂

Unfortunately it is not background-color of the text I would change. It is the background-color for the checkbox I would like to change.

I have tried to tweak the code but can't get the checkbox it self to change color. See attached image.

I have also used several databases to try and find a solution but without luck.

Do you have any idea how to do that?

Thank you in advance.

Kristen

#2132005
#2134035

Thank you Luo Yang.

Unfortunately it doesn't solve the problem. I wonder if the problem is AJAX-update of the view?

Kind regards Kristen

#2134235
checkboxes3.JPG

I have tried the same CSS codes in your website:

input[type='checkbox']{
  width: 14px !important;
  height: 14px !important;
  margin: 5px;
  -webkit-appearance: none;
  -moz-appearance: none;
  -o-appearance: none;
  appearance: none;
  outline: 1px solid gray;
  box-shadow: none;
  font-size: 0.8em;
  text-align: center;
  line-height: 1em;
  background: red;
}

input[type='checkbox']:checked:after {
  content: '✔';
  color: white;
}

I can see it does work, see my screenshot checkboxes3.JPG

And it is only a demo for your reference, you need to customize the CSS codes manually.

#2137243

My issue is resolved now. Thank you!