css实现checkbox多选框美化效果代码
代码语言:html
所属分类:表单美化
代码描述:css实现checkbox多选框美化效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> *:{ margin: 0; padding: 0; box-sizing: border-box; } html{ color-scheme: dark; font-family: system-ui; } :root{ --clr-primary: #F5F5F5; } body{ min-height: 100svh; display: grid; place-content: center; font-size: 1.4rem; color: var(--clr-primary); } h1{ font-size: 2.2rem; font-weight: 500; } form{ --_clr-hover: #F472B6; --_clr-checked: #38BDF8; } form > div{ --_clr-current: var( --clr-primary); display: flex; align-items: center; gap: .5rem; } form > div + div{ margin-block-start: .5rem; } label{ cursor:pointer; color: var(--_clr-current); transition: color 150ms ease-in-out; } /* styled checkbox */ input[type='checkbox']{ appearance: none; outline: none; width: 1.5rem; height: 1.5rem; aspect-ratio: 1; padding: .25rem; background: transparent; border: 1px solid var(--_clr-current); border-radius: 2px; display: grid; place-content: center; cursor: pointer; } input[type='checkbox']::after{ content: '\2714'; opacity: 0; transition: opacity 150ms ease-in-out; color: var(--_clr-checked); font-size: inherit; font-family: inherit; } label:hover, input[type='checkbox']:focus-visible, in.........完整代码请登录后点击上方下载按钮下载查看
网友评论0