Principle: First hide the input element, then use CSS to set the style of the label element (other elements can also be used). When selected, use input:check+label to select the label, without using images and JS Effect Preview HTML code <div class="radio"> <input type="checkbox" id="sex1"> <label for="sex1"></label> Male <div class="radio"> <input type="checkbox" id="sex2"> <label for="sex2"></label> Female</div> CSS Code .radio { position: relative; display: inline-block; margin-right: 12px; } .radio input { width: 15px; height: 15px; appearance: none;/*Clear default style*/ -webkit-appearance: none; opacity: 0; outline: none; z-index: 8; /*Make the input level higher than the label so that it can be selected*/ } .radio label { position: absolute; left: 0; top: 6px; width: 15px; height: 15px; border: 1px solid #3582E9; } .radio input:checked+label::after { content: ""; position: absolute; left: 4px; top: 0px; /* Here half of the rectangle is displayed and then rotated 45 degrees to achieve the check mark style*/ width: 5px; height: 12px; border-right: 1px solid #000000; border-bottom: 1px solid #000000; transform: rotate(45deg); } The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. |
<<: Comprehensive analysis of MySql master-slave replication mechanism
>>: How to configure multiple projects with the same domain name in Nginx
This article records the specific steps for downl...
1. Download the virtual machine Official download...
1. Use the speed control function to control the ...
In the past few days, I have studied how to run s...
Table of contents Preface VMware clone virtual ma...
Of course, it also includes some personal experien...
background Solving browser compatibility issues i...
1. When the width of the adjacent floating layer o...
Table of contents Preface 1. MySQL main storage e...
This article uses examples to illustrate the simp...
First look at the example code: #/bin/bash cal da...
introduce This article is based on React + antd t...
Reproduce on Kali First set suid permissions for ...
If you are using the latest Ubuntu Server version...
Web Server 1. The web server turns off unnecessar...