js+css实现爱心漂浮开关动画效果代码
代码语言:html
所属分类:其他
代码描述:js+css实现爱心漂浮开关动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> @import url("https://fonts.googleapis.com/css?family=Montserrat:400,400i,700"); body { background-color: FloralWhite; display: flex; align-items: center; justify-content: center; height: 100vh; margin: 0; font-family: Montserrat, sans-serif; } .container { display: flex; } .toggle [aria-pressed] { display: block; box-sizing: border-box; border: none; color: inherit; background: none; font: inherit; line-height: inherit; text-align: left; padding: 0.5rem 0 0 4rem; position: relative; } .toggle [aria-pressed]::before, .toggle [aria-pressed]::after { content: ""; position: absolute; height: 1.5rem; transition: all 0.25s ease; } .toggle [aria-pressed]::before { left: 0; top: 0.2rem; width: 3rem; border: 0.2rem solid #80848e; background: #80848e; border-radius: 1.1rem; } .toggle [aria-pressed]::after { left: 0; top: 0.25rem; background-color: #fff; background-position: center center; border-radius: 50%; width: 1.5rem; border: 0.15rem solid #80848e; } .toggle [aria-pressed=true]::after { left: 1.6rem; border-color: #23a55a; color: #23a55a; border-radius: 1rem; } .toggle [aria-pressed=true]::before { background-color: #23a55a; border-color: #23a55a; } .toggle [aria-pressed]:active::after { border-color: rgba(35, 165, 90, 0.8); color: rgba(35, 165, 90, 0.8); width: 2rem; .........完整代码请登录后点击上方下载按钮下载查看
网友评论0