How to Create Custom Radio Button using HTML and CSS ? Last Updated : 28 Apr, 2025 Comments Improve Suggest changes 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 create a shinny button using HTML and CSS ? Buttons are undoubtedly one of the most important components of any website or app. A button should be designed in such a way that it stands out of the other component so that it is becoming clear to the user where to click and what is the button used for. There are infinite ways in which a button c 3 min read 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 Transparent Button using HTML and CSS? Transparent buttons are a popular design choice in modern web development, as they create a sleek and minimalist look. By using CSS, you can easily create buttons with fully transparent or semi-transparent backgrounds. This article uses the background-color: transparent; property to design the trans 2 min read How to create a Split Button Dropdown using CSS ? In this article, we will learn how to design a split button dropdown using CSS. Split buttons combine a main button with a dropdown, useful for adding interactive features to your website. This guide helps you improve your web design skills by showing you how to make a split button in easy steps. Ta 4 min read How to Create Badges using HTML and CSS ? This article will show you how to create a badge using HTML and CSS. Badges are simple and basic components that are used to display an indicator or count a number. This is quite useful for mail count and alerting purposes, among other things. Badges are identical to labels, with the exception that 2 min read How to create Popup Box using HTML CSS and JavaScript? Creating a popup box with HTML, CSS, and JavaScript improves user interaction on a website. A responsive popup appears when a button is clicked, featuring an HTML structure, CSS for styling, and JavaScript functions to manage visibility.ApproachCreate the Popup structure using HTML tags, Some tags a 3 min read Create a Button Group using HTML and CSS This article will show you how to create a Button Group with the help of HTML and CSS. To create the Button Group, first, we create buttons using the HTML <button> element and then apply some CSS styles to make all buttons in a group. First, we create a div container with the class name .butto 2 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 Create Toggle Switch by using HTML and CSS? A toggle switch allows users to switch between two states, typically "on" and "off," and is commonly used in forms and interactive elements. To create a toggle switch, we will use HTML and CSS. We can add different styles to the checkbox element to create a toggle switch.1. Basic Circular Toggle Swi 3 min read How to create Text Buttons using CSS ? In this article, we are going to see how to create text buttons using CSS. The text button is a button that appears to be text but acts as a button if we press it. Text buttons are different from anchor tags even if they might look similar. To create text buttons first, we create simple buttons in H 2 min read Like