css美化radio标签实现滑动式单选效果代码
代码语言:html
所属分类:表单美化
代码描述:css美化radio标签实现滑动式单选效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
body {
width: 100vw;
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
background-color: #0050B7;
}
fieldset {
border: none;
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-template-rows: 100%;
height: 55px;
width: fit-content;
background-color: rgba(0, 0, 0, 0.35);
padding: 6px;
border-radius: 10px;
gap: 4px;
--active: 0;
}
fieldset:has(label:nth-child(2) input:checked) {
--active: 1;
}
fieldset:has(label:nth-child(3) input:checked) {
--active: 2;
}
fieldset .selector {
grid-area: 1/1/2/2;
height: 100%;
width: 100%;
border-radius: 6px;
position: relative;
pointer-events: none;
}
fieldset .selector::before, fieldset .selector::after {
content: "";
position: absolute;
top: 0;
left: 0;
width: 100%;
hei.........完整代码请登录后点击上方下载按钮下载查看
网友评论0