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
1. Add the following dependencies in pom.xml <...
Detailed explanation of JDBC database link and re...
This article introduces the sample code of CSS3 t...
This article shares the 6 most effective methods,...
Preface Today, Prince will talk to you about the ...
Comprehensive understanding of html.css overflow ...
Table of contents Preface 1. Install Docker 2. In...
Docker is becoming more and more mature and its f...
Preface The SQL mode affects the SQL syntax that ...
Table of contents 1 Conceptual distinction 2 Case...
This article example shares the specific code of ...
Prepare the ingredients as shown above (ps: hadoo...
Table of contents Preface Descriptors Detailed ex...
1. Linux under VMware Workstation: 1. Update sour...
Table of contents 1. Common mistakes made by begi...