How to Create Custom Radio Button using HTML and CSS ? Last Updated : 28 Apr, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report The simple radio button can be customized using HTML and CSS easily. We will use some CSS properties to create a custom radio button. The :after pseudo-element and checked attribute is used to set some CSS property. The complete code is divided into two sections, the first section contains the HTML code and the second section contains the CSS code to create a custom radio button.HTML Code: In this section, we will create a simple radio button using the <label> and <input> tags. HTML <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> How to Create Custom Radio Button using HTML and CSS? </title> </head> <body> <h1>GeeksforGeeks</h1> <h3> Create Custom Radio Button using HTML and CSS </h3> <div> <label class="radio"> <input type="radio"> Button <div class="circle"></div> </label> </div> </body> </html> CSS Code: In this section, we will design the radio button using the :after pseudo element and checked attribute. CSS <style> body { text-align: center; } h1 { color: green; } div { margin: 0; padding: 0; box-sizing: border-box; font-family: serif; font-size: 3em; display: flex; align-items: center; justify-content: center; } .radio { font-size: 30px; font-weight: 500; display: inline-flex; align-items: center; color: black; } input { display: none; } .circle { position: relative; height: 25px; width: 25px; border: 5px solid #3CE75B; display: inline-block; right: 125px; border-radius: 50%; } .circle:after { content: ''; height: 10px; width: 10px; display: block; position: absolute; background: #3CE75B; left: 50%; top: 50%; transform: translate(-50%, -50%); border-radius: 50%; opacity: 0; } .radio input:checked~.circle:after { opacity: 1; } </style> Complete Code: In this section, we will combine the above two sections (HTML and CSS) code to create a custom radio button. HTML <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> How to Create Custom Radio Button using HTML and CSS? </title> <style> body { text-align: center; } h1 { color: green; } div { margin: 0; padding: 0; box-sizing: border-box; font-family: serif; font-size: 3em; display: flex; align-items: center; justify-content: center; } .radio { font-size: 30px; font-weight: 500; display: inline-flex; align-items: center; color: black; } input { display: none; } .circle { position: relative; height: 25px; width: 25px; border: 5px solid #3CE75B; display: inline-block; right: 125px; border-radius: 50%; } .circle:after { content: ''; height: 10px; width: 10px; display: block; position: absolute; background: #3CE75B; left: 50%; top: 50%; transform: translate(-50%, -50%); border-radius: 50%; opacity: 0; } .radio input:checked~.circle:after { opacity: 1; } </style> </head> <body> <h1>GeeksforGeeks</h1> <h3> Create Custom Radio Button using HTML and CSS </h3> <div> <label class="radio"> <input type="radio"> Button <div class="circle"></div> </label> </div> </body> </html> Output: Comment More infoAdvertise with us Next Article How to Create Custom Radio Button using HTML and CSS ? L lakshgoel204 Follow Improve Article Tags : Web Technologies Web Templates Similar Reads How to add Radio Buttons in form using HTML ? In this article, we will learn how to add Radio Buttons in form using HTML. We know that Radio Buttons are used to select only one option out of several options. It is generally used in HTML form. If we want to deselect any option we have to select another option in the case of a radio button. Appro 1 min read How to Create a Slider using HTML and CSS? A slider (also called a slideshow) is a sequence of content frames that users can navigate through. Creating a slider using just HTML and CSS is efficient because it doesn't require JavaScript, making it lightweight and fast. The slider can contain images, text, or any other content you want to show 3 min read How to Change the Color of Radio Buttons using CSS? Here are three methods to change the color of radio Buttons using CSS:1. Using the accent-color PropertyThe accent-color property allows you to set the color of form controls like radio buttons and checkboxes.HTML<html> <head> <style> input[type="radio"] { accent-color: green; } 3 min read How to Show and Hide div elements using radio buttons? In this article, we will see how we can show and hide div elements by clicking on the radio buttons. There are different methods available in jQuery to accomplish this task as listed below: Table of Content Using the hide() and show() methodsUsing the css() methodUsing the hide() and show() methodsT 3 min read How to Disable Radio Button in HTML? This article will show you how to disable Radio Button in HTML. The disabled attribute is used to disable a radio button in HTML. This attribute prevents the radio button from being selected by the user. Using the disabled AttributeThe disabled attribute is used to disable the input fields. To disab 2 min read Like