# Realistic Red Switch **Repository Path**: haiyongcsdn/realistic-red-switch ## Basic Information - **Project Name**: Realistic Red Switch - **Description**: 逼真的红色按钮 - **Primary Language**: HTML - **License**: MulanPSL-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-03-23 - **Last Updated**: 2021-03-24 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Realistic Red Switch ![在这里插入图片描述](https://img-blog.csdnimg.cn/20210323223642618.gif#pic_center) 在制作过程中,我使用了各种不同的CSS技术,包括渐变,3D转换,动画和过渡。在本教程中,我将深入探讨其中的一些技术。 演示地址:[http://haiyongcsdn.gitee.io/realistic-red-switch/](http://haiyongcsdn.gitee.io/realistic-red-switch/) ## 模拟状态 开关具有2个状态-开启和关闭,但是CSS无法保持这种状态。 为了解决这个问题,我们可以使用原生HTML元素之一。由于我们只需要维护2个状态,因此**checkbox**元素是一个不错的选择。我们可以使用`:checked`CSS选择器根据复选框是否选中来应用CSS。 我们将整个内容包装在`