iOS Style Animated Radio Buttons & Checkbox (CSS Only)

preview_player
Показать описание
Create iOS style animated radio buttons and checkboxes by using only CSS without JavaScript or jQuery. We have looked into how can we create CSS only radio buttons and checkboxes. Then we have looked into how can we create CSS and JavaScript based radio buttons and checkboxes. Then we learned how can we create radio buttons and checkboxes where we have separate input and label tags. Where input is not inside label. This video is even more special. In this, we will learn about 'plus CSS selector' and 'tidla CSS selector'. We will create iOS style radio buttons and checkboxes by using only CSS. No JavaScript.

- Tilda CSS selector is used to select all elements next to an element
- Plus CSS selector is used to select only first next element to an element
- Even if input radio or checkbox is not inside label, you can still use for attribute in label and use relevant input's id to toggle that input when you click at label

Use input's ID in label as value for 'for' attribute
input is placed outside label here
When I will click at label, its related input will be toggled

I will create two groups of radio buttons and few check boxes. Then we will give them iOS style and toggle them by using only CSS.

Radio group has radio buttons with same name. Input is inside label. So at label click, input will be toggled. Toggling is already happening without JavaScript or any CSS because input is inside label.

Our label is at position relative because our styled iOS button will use CSS pseudo elements with absolute position.

This is for regular style
label input + span::before { }
label input + span::after { }

We have span next to input
We will use CSS pseudo elements on span
At before pseudo element, we will use track
At after pseudo element we will use a rounded button

Instead of plus CSS selector you can use Tilda ~ but in my opinion, use plus (+) CSS selector.

For checked state of inputs, we will get the checked input, select span next to it, and target its before and after CSS pseudo elements.

This is for checked style
label input:checked + span::before { }
label input:checked + span::after { }

You can create smooth animations by using CSS only. In regular state only use transition property for animation. Do not use it for hover or checked state. For regular state its sufficient

Now we will hide original radio buttons and check boxes, because we have our own styles. And this is how you can create iOS styled animated radio buttons and checkboxes by using only CSS.

- iOS Style Animated Radio Buttons & Checkbox (CSS, jQuery)

Thank You!
👍 LIKE VIDEO
👊 SUBSCRIBE
🔔 PRESS BELL ICON
✍️ COMMENT

#webstylepress #tutorials #webdevelopment #css #csstutorial #css3 #webdesign #html #htmlcss #htmltutorial
Комментарии
Автор

To watch more related videos, please LIKE, SHARE & SUBSCRIBE! WebStylePress needs your support.

webstylepress
Автор

Thank you very much for the video, very useful, simple and informative!

someone