How to Create a Custom Radio Button - HTML & CSS Tutorial

preview_player
Показать описание
In this video tutorial I'll be showing you how to create a custom radio button using pure HTML & CSS - No JavaScript required!

This is super easy to do and only takes around 40 lines of CSS.

Support me on Patreon:

Follow me on Twitter @dcodeyt!

If this video helped you out and you'd like to see more, make sure to leave a like and subscribe to dcode!
Рекомендации по теме
Комментарии
Автор

This was excellent, thanks! For accesibility, I would recommend a modification: change ".radio__input" by removing the "display: none" CSS and adding "position: absolute; opacity: 0". This way, you can still select the element with the keyboard, but it's invisible and doesn't interfere with the spacing of other elements around it.

mezzanine
Автор

Thank you for this tutorial! Quick question, how do we make it so that the button is able to be deselected?

allisonlowe
Автор

This was an outstanding, quick, and very informative tutorial. Thank you!

jaymonserrat
Автор

thank u very much this is actually what i need for my exam.

HilolaFayoziddinova
Автор

thanks! i didn't know how to align the buttons to the left

JesusPetit
Автор

all this code doesn't work in 2022

stanislavshilo
Автор

finally tysm

i edited ur code and make it look like button instead

arc
Автор

Thank you for a valuable lesson! You hepled me to solve my problem

Катерина-ял
Автор

2:50 you don't need the for attribute if you're wrapping the input field with the label element

thiagoleobons
Автор

This is great and smart, man! I'm happy you didn't use any JS for this

work
Автор

Thanks a lot! It's very helpful 🥳

ImArtfulLee
Автор

Thank you !!! I will certainly integrate this HTML and CSS in your "beautiful forms" tuto/template for radio buttons.
I like your work very much !

angladephil
Автор

Great, but when you put the input inside the label, it is not necessary to set the for attribute. Thanks.

carlosnucette
Автор

Wow. Double thanks. Just watch your other tutorial and it was very good. This one is just as good. Love them!

qcdiamond
Автор

what font and theme do you use sir? i realy love it

jejakkaki
Автор

A perfect tutorial, great job! :) Very elegant

faythe
Автор

extremly perfect thank you very much bro

theethicalh
Автор

Great but I have a question why when I'm making a selection it doesn't show anything of my selection

shiekha
Автор

Hermano! Muchas gracias, es el mejor video! Explicado a detalle y sobre todo con el código más limpio! Muchas gracias!

elliotgaramendi
Автор

thank you so much, just subscribed :)

ashrafess