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?
-
What do you mean by native CSS styles?SapuSeven– SapuSeven2018-08-27 06:13:40 +00:00Commented Aug 27, 2018 at 6:13
-
background-color, color,..Ashokan Sivapragasam– Ashokan Sivapragasam2018-08-27 06:16:12 +00:00Commented Aug 27, 2018 at 6:16
-
3Because 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.cloned– cloned2018-08-27 06:25:30 +00:00Commented Aug 27, 2018 at 6:25
Add a comment
|
1 Answer
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