
- CSS Tutorial
- CSS - Home
- CSS - Introduction
- CSS - Syntax
- CSS - Inclusion
- CSS - Measurement Units
- CSS - Colors
- CSS - Backgrounds
- CSS - Fonts
- CSS - Text
- CSS - Images
- CSS - Links
- CSS - Tables
- CSS - Borders
- CSS - Margins
- CSS - Lists
- CSS - Padding
- CSS - Cursors
- CSS - Outlines
- CSS - Dimension
- CSS - Scrollbars
- CSS Advanced
- CSS - Visibility
- CSS - Positioning
- CSS - Layers
- CSS - Pseudo Classes
- CSS - Pseudo Elements
- CSS - @ Rules
- CSS - Text Effects
- CSS - Media Types
- CSS - Paged Media
- CSS - Aural Media
- CSS - Printing
- CSS - Layouts
- CSS - Validations
- CSS3 Tutorial
- CSS3 - Tutorial
- CSS3 - Rounded Corner
- CSS3 - Border Images
- CSS3 - Multi Background
- CSS3 - Color
- CSS3 - Gradients
- CSS3 - Shadow
- CSS3 - Text
- CSS3 - Web font
- CSS3 - 2d transform
- CSS3 - 3d transform
- CSS3 - Animation
- CSS3 - Multi columns
- CSS3 - User Interface
- CSS3 - Box Sizing
- CSS Responsive
- CSS - Responsive Web Design
- CSS References
- CSS - Questions and Answers
- CSS - Quick Guide
- CSS - References
- CSS - Color References
- CSS - Web browser References
- CSS - Web safe fonts
- CSS - Units
- CSS - Animation
- CSS Resources
- CSS - Useful Resources
- CSS - Discussion
Custom Radio Buttons with CSS appearance Property
We use the appearance property to style an element according to the platform-native style of the user’s operating system.
Syntax
The syntax of CSS appearance property is as follows −
Selector { appearance: /*value*/; -webkit-appearance: /*value*/; /*for Safari and Chrome */ -moz-appearance: /*value*/; /*for Firefox */ }
Example
The following examples illustrate CSS appearance property.
<!DOCTYPE html> <html> <style> input[type=radio] { appearance: none; -webkit-appearance: none; -moz-appearance: none; padding: 10px; background-color: orange; border-radius:50%; } input[type=radio]:checked { background-color: magenta; } input[type=radio]:hover { cursor: pointer; } </style> <body> Custom radio button example<br/> <form> <label for="r1">r1</label> <input type="radio" id="r1" name="btn" value="v1"> <input type="radio" id="r2" name="btn" value="v2"> <label for="r2">r2</label> </form> </body> </html>
This gives the following output
Example
<!DOCTYPE html> <html> <style> label { display: flex; align-items: top; } label input { margin: 0px 10px 0px 10px; } input[type=checkbox] { appearance: none; -moz-appearance: none; -webkit-appearance: none; border: 3px ridge currentcolor; border-radius: 60px; box-sizing: content-box; color: lightblue; height: 60px; padding: 2px 2px 2px 2px; transition-duration: 280ms; transition-property: border-color, color; transition-timing-function: ease; width: 20px; } input[type=checkbox]:checked { color: lightgreen; } input[type=checkbox]::after { background-color: currentcolor; border-radius: 10px 10px 10px 10px; content: ""; display: block; height: 20px; transform: translateY(0px); transition: transform 300ms ease-in; width: 20px ; } input[type=checkbox]:checked::after { transform: translateY(40px); } </style> <body> <p> Custom radio button example <label for="crb"> Blue <input id="crb" type="checkbox"/> <br/><br/><br/>Green </label> </p> </body> </html>
This gives the following output
- Related Articles
- Custom Checkbox with CSS appearance Property
- How to create custom checkboxes and radio buttons with CSS?
- Preappend or Append radio buttons and checkboxes with Bootstrap
- Create Hoverable Buttons with CSS
- How to Disable Radio Buttons using JavaScript?
- How to create a form with custom buttons in HTML
- How to style "alert" buttons with CSS?
- How to style outline buttons with CSS?
- How to create fading buttons with CSS?
- How to create loading buttons with CSS?
- How to style download buttons with CSS?
- How to create pill buttons with CSS?
- How to create notification buttons with CSS?
- How to create icon buttons with CSS?
- How to style text buttons with CSS?

Advertisements