0

I am trying to find direct CSS to apply for checkbox. But I could only find the hacks for styling checkbox or radio button. Unlike input[type=button] or [type=text], why would checkbox or radio button not allow the native CSS styles?

3
  • What do you mean by native CSS styles? Commented Aug 27, 2018 at 6:13
  • background-color, color,.. Commented Aug 27, 2018 at 6:16
  • 3
    Because these elements are rendered by the operating system and the browser doesn't really have access to these elements. That's why you need to use hacks to style them. Commented Aug 27, 2018 at 6:25

1 Answer 1

1

You can't directly style checkbox or radio input. It's styled by browser. If you want to do some customization, you need to hide it, and style it through pseudo element like :before/:after or just use a span etc..

Here are som simple examples: https://www.w3schools.com/howto/howto_css_custom_checkbox.asp

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.