Home Web Front-end HTML Tutorial Pure css3 simple and practical checkbox and radio button_html/css_WEB-ITnose

Pure css3 simple and practical checkbox and radio button_html/css_WEB-ITnose

Jun 24, 2016 am 11:58 AM
css3 Radio checkbox practical

Yesterday I shared with you a cool checkbox and radio button. Today I will bring you a simple and practical checkbox and radio button. The interface is clear and comfortable. Let me give you a rendering first:

Online preview Source code download

Implement the html code:

<div class="frame">        <input checked="checked" id="radio_1" name="radio" type="radio">        <label class="radio" for="radio_1">            <i class="fa fa-times"></i>        </label>        <input id="radio_2" name="radio" type="radio">        <label class="radio" for="radio_2">            <i class="fa fa-times"></i>        </label>        <input id="radio_3" name="radio" type="radio">        <label class="radio" for="radio_3">            <i class="fa fa-times"></i>        </label>        <input id="radio_4" name="radio" type="radio">        <label class="radio" for="radio_4">            <i class="fa fa-times"></i>        </label>        <input id="radio_5" name="radio" type="radio">        <label class="radio" for="radio_5">            <i class="fa fa-times"></i>        </label>    </div>    <div class="frame">        <input checked="checked" id="check_1" name="check" type="checkbox">        <label class="check" for="check_1">            <i class="fa fa-check"></i>        </label>        <input id="check_2" name="check" type="checkbox">        <label class="check" for="check_2">            <i class="fa fa-check"></i>        </label>        <input id="check_3" name="check" type="checkbox">        <label class="check" for="check_3">            <i class="fa fa-check"></i>        </label>        <input id="check_4" name="check" type="checkbox">        <label class="check" for="check_4">            <i class="fa fa-check"></i>        </label>        <input id="check_5" name="check" type="checkbox">        <label class="check" for="check_5">            <i class="fa fa-check"></i>        </label>    </div>
Copy after login

css3 code:

      form        {            width: 100vw;            height: 100vh;            display: flex;            flex-flow: column wrap;            justify-content: center;            align-items: center;        }        form .frame        {            display: flex;            flex-flow: row nowrap;        }        form .frame input        {            display: none;        }        form .frame label        {            cursor: pointer;            position: relative;            width: 30px;            height: 30px;            margin: 10px;            background: #8ABA56;            transition: all 0.3s ease-in-out;            font-size: 12pt;            color: #FFF;            -webkit-font-smoothing: antialiased;        }        form .frame label.radio        {            border-radius: 100%;        }        form .frame label.check        {            border-radius: 5px;        }        form .frame label .fa        {            position: absolute;            top: 0;            left: 0;            right: 0;            bottom: 0;            opacity: 0;            -webkit-transform: scale(0);            transition: all 0.3s ease-in-out;            line-height: 30px;            text-align: center;        }        form .frame input:checked + label        {            background: #678b40;        }        form .frame input:checked + label .fa        {            opacity: 1;            -webkit-transform: scale(1);        }
Copy after login

Okay. Copy the above html code and css code. Easily create a beautiful checkbox and radio button

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1663
14
PHP Tutorial
1266
29
C# Tutorial
1239
24
How to achieve wave effect with pure CSS3? (code example) How to achieve wave effect with pure CSS3? (code example) Jun 28, 2022 pm 01:39 PM

How to achieve wave effect with pure CSS3? This article will introduce to you how to use SVG and CSS animation to create wave effects. I hope it will be helpful to you!

Practical tips for converting full-width English letters into half-width form Practical tips for converting full-width English letters into half-width form Mar 26, 2024 am 09:54 AM

Practical tips for converting full-width English letters into half-width forms. In modern life, we often come into contact with English letters, and we often need to input English letters when using computers, mobile phones and other devices. However, sometimes we encounter full-width English letters, and we need to use the half-width form. So, how to convert full-width English letters to half-width form? Here are some practical tips for you. First of all, full-width English letters and numbers refer to characters that occupy a full-width position in the input method, while half-width English letters and numbers occupy a full-width position.

PyCharm Beginner's Guide: Learn to Delete Projects in PyCharm PyCharm Beginner's Guide: Learn to Delete Projects in PyCharm Feb 23, 2024 pm 09:39 PM

PyCharm Beginner's Guide: Practical Tips for Deleting Projects PyCharm is a powerful Python integrated development environment (IDE). When developing projects, sometimes you need to delete projects or files in the projects. This article will introduce practical techniques for deleting projects in PyCharm, and provide specific code examples to help novices better understand and apply. 1. Delete the project Deleting the project means deleting the entire project folder, which is very useful when we need to clean or rebuild the project. Delete in PyCharm

Use CSS skillfully to realize various strange-shaped buttons (with code) Use CSS skillfully to realize various strange-shaped buttons (with code) Jul 19, 2022 am 11:28 AM

This article will show you how to use CSS to easily realize various weird-shaped buttons that appear frequently. I hope it will be helpful to you!

How to hide elements in css without taking up space How to hide elements in css without taking up space Jun 01, 2022 pm 07:15 PM

Two methods: 1. Using the display attribute, just add the "display:none;" style to the element. 2. Use the position and top attributes to set the absolute positioning of the element to hide the element. Just add the "position:absolute;top:-9999px;" style to the element.

How to implement lace borders in css3 How to implement lace borders in css3 Sep 16, 2022 pm 07:11 PM

In CSS, you can use the border-image attribute to achieve a lace border. The border-image attribute can use images to create borders, that is, add a background image to the border. You only need to specify the background image as a lace style; the syntax "border-image: url (image path) offsets the image border width inward. Whether outset is repeated;".

Use jQuery to implement real-time updates of checkbox selected status Use jQuery to implement real-time updates of checkbox selected status Feb 23, 2024 pm 03:45 PM

Using jQuery to Real-time Update the Selected Status of Check Boxes In web development, we often encounter situations where we need to update the selected status of check boxes in real time. By using jQuery, we can easily implement the function of updating the selected status of the check box in real time. Here's how to use jQuery to accomplish this task. First, we need to prepare a simple HTML structure containing multiple checkboxes:

How to enlarge the image by clicking the mouse in css3 How to enlarge the image by clicking the mouse in css3 Apr 25, 2022 pm 04:52 PM

Implementation method: 1. Use the ":active" selector to select the state of the mouse click on the picture; 2. Use the transform attribute and scale() function to achieve the picture magnification effect, the syntax "img:active {transform: scale(x-axis magnification, y Axis magnification);}".

See all articles