Use css3 to implement switch component switching
This article mainly introduces to you the relevant information on how to use css3 to implement the switch component. The editor thinks it is quite good, so I will share it with you now and give it as a reference. Let’s follow the editor to take a look, I hope it can help everyone.
Form-based checkbox
Rendering
##Principle
checkbox, has two states, unchecked and selected. When checked (:checked), just change the style. First, you must clear the browser's default style, apperance: none. The code in this article only runs in chrome. If You need to write compatibility code, just add prefixes to appearance and transitionhtml code##
<input class='switch-component' type='checkbox'>
css code
// switch组件 .switch-component { position: relative; width: 60px; height: 30px; background-color: #dadada; border-radius: 30px; border: none; outline: none; -webkit-appearance: none; transition: all .2s ease; } // 按钮 switch-component::after { content: ''; position: absolute; top: 0; left: 0; width: 50%; height: 100%; background-color: #fff; border-radius: 50%; transition: all .2s ease; } // checked状态时,背景颜色改变 .switch-component:checked { background-color: #86c0fa; } // checked状态时,按钮位置改变 .switch-component:checked::after { left: 50%; }
Related recommendations:
The above is the detailed content of Use css3 to implement switch component switching. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Differences between the Japanese version of the switch and the Hong Kong version: 1. There are major differences in the charger. The Japanese version and the national standard charging port are common, and the Hong Kong version uses a British triangle plug; 2. The Japanese version uses point card payment, while the Hong Kong version uses Alipay; 3. , The after-sales warranty for the Hong Kong version needs to be mailed back to the HK after-sales point, while the Japanese version needs to be mailed to the designated after-sales point in Japan.

Can Elden's Ring be played on the switch? As a very charming action RPG game, many friends may not know whether it can be played smoothly on the switch platform. The answer is that it cannot be played at the moment. accomplish. Can Ring of Elden be played on switch? Answer: It cannot be played on switch. This highly anticipated Souls series role-playing action game has been officially released. Players can purchase it on PC, PS4/5 and Xbox Series eX|S/XboxOne and experience it immediately. Many friends who own a switch may still be eager to enjoy this game on the NS, but unfortunately, there is no switch version of the game. According to the official website configuration requirements, the game configuration is relatively high, and sw

Solution for the switch not responding to the TV: 1. Check whether the power supply of the switch and the TV are connected; 2. Check whether the TV HDMI cable interface is plugged in tightly; 3. Open the back cover of the Switch base and check whether the power cord and HDMI cable are plugged in tightly; 4. Check whether the Switch is turned on and put into the base; 5. Check whether the TV has switched the signal source.

The switch cannot be charged on the base all the time. The hazards are: 1. Shortening the battery life and battery life; 2. Cause the memory to burn out.

The memory of switch32g is not enough. The reasons are as follows: 1. If you buy digital games and want to buy DLC screenshots and store them in the handheld machine, it is not enough. 2. When downloading digital games, 32G memory can store about 2 to 3 games, which is not enough. The need to play games; 3. Digital games and their DLC are generally maintained on 5G. Except for the space occupied by the built-in system, downloading games is more difficult for players.

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;".

The differences between switch lite and switch are: 1. Different sizes; 2. Different screen sizes and body weights; 3. Different handles whether they are detachable and different handle functions; 4. Different battery life; 5. Different handle button designs; 6. Can Support different games; 6. Different colors.

According to news from this website on September 2, Reddit forum user TheRealImAHeroToo broke the news that Sega has had a Switch2 development kit for some time. The new console will have new camera functions and can be backward compatible with some tested games. SquareEnix has a new PS5 development kit, and "Final Fantasy 7: Remake" looks like a PS5 game when running on Switch 2. The whistleblower's account has been deleted and he said he will no longer leak information because the risk is too high. This website noticed that the whistleblower also mentioned: Another Sega Sonic game "Persona 6" will be released next year, which may not be released next year. The theme is "Black and White"; there is another one that has not been announced yet. of "Female"
