Yogesh Chauhan's Blog

How to change the style for checked radio button or checkboxes using CSS?

in CSS on March 9, 2021

CSS selectors are pretty handy sometimes when we want to style elements based on user interaction.

To change the style for checked radio button or checkboxes we can use CSS :checked Selector.

The :checked selector matches checked input elements for checkboxes and radio buttons and and option element.

It’s supported in all major browsers.

:checked selector syntax


:checked {
  style the checked elements
}

Example Solution


Most Read

#1 How to check if radio button is checked or not using JavaScript? #2 Solution to “TypeError: ‘x’ is not iterable” in Angular 9 #3 How to add Read More Read Less Button using JavaScript? #4 How to uninstall Cocoapods from the Mac OS? #5 PHP Login System using PDO Part 1: Create User Registration Page #6 How to Use SQL MAX() Function with Dates?

Recently Posted

#Aug 15 Is PHP still good for back-end programming? #Aug 10 How to create a multisite network in WordPress? #Aug 3 How to create a circle that follows a cursor using JavaScript and CSS? #Aug 3 How to make a curtain slider using jQuery and CSS? #Aug 2 How to progressively load images and add a blurry placeholder? #Aug 1 How to create a placeholder loader (throbber) using CSS?
You might also like these
How to create a full screen loader using CSS and JavaScript?CSS5 Key Principles Of Good Website UsabilityUI/UXHow to add Date and Time picker in HTML and get the values using JavaScript?HTMLThe fundamental difference between HAVING and WHERE clauses in PostgresPostgresHow to change the Login Logo in WordPress?WordPressHow to get the full URL of current page in PHP?PHPSelector Lists and Combinators in SCSS (Sass)SCSSHow to remove border from :visited image, link or button?CSSHow to load a module with configuration in SCSS?SCSSIntroduction to Angular modules Part 3: NgModules vs JavaScript modules and Angular librariesAngularOpen Source Security Tools for Defense SecurityMiscellaneousWhy does MOV matter in IT or any kind of projects?Miscellaneous