Javatpoint Logo
Javatpoint Logo

CSS checkbox style

The checkbox is an HTML element used to take input from the user. It is hard to style the checkbox, but pseudo-elements makes it easier to style a checkbox.

This HTML element is generally used on every website, but without styling them, they look similar on every website. So, styling them will make our site different and attractive. We have to hide the original checkbox in order to style the checkbox. Styling the checkboxes using CSS is an interesting and creative task, which will provide a new and attractive look to the default checkbox.

Styling of the checkbox will be clear by using some illustrations. Let's see some of the illustrations for the same.

Example1

In this example, we are using the '~' which is the sibling combinator. It selects all elements that are preceded by the previous selector. We have also used the pseudo-class :hover to style the checkbox when the user moves the cursor over it.

Test it Now

Example2

In this example, we are going to see the modified checkmark.

Test it Now

Example3

Now, we are going to see another example of styling the checkbox. In this example, we will see the ripple effect, which makes the checkbox more attractive. This effect gives a new look to the checkbox. Similar to the above example, we have also use the '~' sibling combinator, which will select all elements preceded by the former selector. There is also the use of some pseudo-classes such as :checked, :before, :after, etc.

See the following example to create the ripple effect in checkbox by using CSS.

Test it Now

Next TopicCSS letter-spacing





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA