纯css实现radio美化选择效果
代码语言:html
所属分类:表单美化
代码描述:纯css实现radio美化选择效果
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <style> /* DEFAULTS */ /* =============================================== */ body { display: grid; place-content: center; min-height: 100vh; margin: 0; padding: 40px; box-sizing: border-box; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Open Sans', sans-serif; } /* MAIN */ /* =============================================== */ .rad-label { display: -webkit-box; display: flex; -webkit-box-align: center; align-items: center; border-radius: 100px; padding: 14px 16px; margin: 10px 0; cursor: pointer; -webkit-transition: .3s; transition: .3s; } .rad-label:hover, .rad-label:focus-within { background: rgba(204, 204, 204, 0.14); } .rad-input { position: absolute; left: 0; top: 0; width: 1px; height: 1px; opacity: 0; z-index: -1; } .rad-design { width: 22px; height: 22px; border-radius: 100px; background: -webkit-gradient(linear, left top, right bottom, from(#40fcab), to(#406ffc)); background: linear-gradient(to right bottom, #40fcab, #406ffc); position: relative; } .rad-design::before { content: ''; display: inline-block; width: inherit; height: inherit; border-radius: inherit; background: #e6e6e6; -webkit-transform: scale(1.1); transform: scale(1.1); -webkit-transition: .3s; transition: .3s; } .rad-input:checked + .rad-design::before { -webkit-transform: scale(0); transform: scale(0); } .rad-text { color: #999999; margin-left: 14px; letter-spacing: 3px; text-transform: uppercase; font-size: 18px; font-weight: 900; -webkit-transition: .3s; transition: .3s; } .rad-input:checked ~ .rad-text { color: #666666; } /* ABS */ /* ====================================================== */ .abs-site-link { position: fixed; bottom: 40px; left: 20px; color: rgba(0, 0, 0, 0.5); font-size: 16px; } .abs-site-link-ripple { position: absolute; top: 50%; left: 50%; width: 6em; height: 6em; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%); } .abs-site-link-ripple::before { content: ''; display: inline-block; width: inherit; height: inherit; border-radius: 100px; background: #a8f0ce; position: absolute; top: 0; left: 0; -webkit-transform-origin: center center; transform-origin: center center; -webkit-animation: ripple 1.8s infinite ease-out; animation: ripple 1.8s infinite ease-out; } @-webkit-keyframes ripple { 0% { -webkit-transform: scale(0); transform: scale(0); opacity: .8; } 100% { -webkit-transform: scale(1); transform: scale(1); opacity: 0; } } @keyframes ripple { 0% { -webkit-transform: scale(0); transform: scal.........完整代码请登录后点击上方下载按钮下载查看
网友评论0