
- 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 Checkbox 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=checkbox] { appearance: none; -webkit-appearance: none; -moz-appearance: none; padding: 12px; background-color: cyan; box-shadow: inset 0 3px 3px 5px lightgreen; border-radius:50%; } input[type=checkbox]:checked { background-color: coral; border: 6px solid cornflowerblue; box-shadow: 0 1px 2px lightorange; } input[type=checkbox]:checked:after { content:"Checked"; } </style> <body> <input type="checkbox"> Custom Checkbox Example </body> </html>
This gives the following output
Example
<!DOCTYPE html> <html> <style> input[type=checkbox] { appearance: none; -webkit-appearance: none; -moz-appearance: none; padding: 10px; background-color: cyan; border-radius:5%; } input[type=checkbox]:checked { background-color: magenta; } input[type=checkbox]:checked:before { content:"\2713"; color: white; padding: initial; font-weight: bold; } </style> <body> <input type="checkbox"> Another Custom Checkbox Example </body> </html>
This gives the following output
- Related Articles
- Custom Radio Buttons with CSS appearance Property
- Hide Dropdown Arrow for Select Input with CSS appearance
- How to get materialize CSS checkbox to work with @Html.CheckBoxFor?
- HTML DOM Input Checkbox checked Property
- HTML DOM Input Checkbox defaultChecked Property
- HTML DOM Input Checkbox autofocus Property
- HTML DOM Input Checkbox disabled Property
- HTML DOM Input Checkbox form Property
- HTML DOM Input Checkbox name Property
- HTML DOM Input Checkbox required Property
- HTML DOM Input Checkbox type Property
- HTML DOM Input Checkbox value Property
- How to control the shape or appearance of the marker with CSS?
- How to create a custom scrollbar with CSS?
- CSS top property with Animation

Advertisements