下拉菜单白天夜晚切换效果
代码语言:html
所属分类:菜单导航
代码描述:下拉菜单白天夜晚切换效果
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <link rel='stylesheet' href='https://s3-us-west-2.amazonaws.com/s.cdpn.io/1462889/unicons.css'> <style> /* Please ❤ this if you like it! */ @import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700;900&display=swap'); *, *::before, *::after { box-sizing: border-box; } body{ font-family: 'Roboto', sans-serif; font-weight: 500; font-size: 15px; line-height: 1.4; color: #fff; background-color: #1f2029; overflow-x: hidden; background-position: center; background-repeat: repeat; background-size: 4%; width: 100%; display: -ms-flexbox; display: flex; -ms-flex-wrap: wrap; flex-wrap: wrap; -ms-flex-pack: center; justify-content: center; padding-top: 100px; padding-bottom: 300px; } .sec-center { position: relative; max-width: 100%; text-align: center; z-index: 200; } [type="checkbox"]:checked, [type="checkbox"]:not(:checked){ position: absolute; left: -9999px; opacity: 0; pointer-events: none; } .dark-light:checked + label, .dark-light:not(:checked) + label{ position: fixed; top: 40px; right: 40px; z-index: 20000; display: block; border-radius: 50%; width: 46px; height: 46px; cursor: pointer; transition: all 200ms linear; box-shadow: 0 0 25px rgba(255,235,167,.45); } .dark-light:checked + label{ transform: rotate(360deg); } .dark-light:checked + label:after, .dark-light:not(:checked) + label:after{ position: absolute; content: ''; top: 1px; left: 1px; overflow: hidden; z-index: 2; display: block; border-radius: 50%; width: 44px; height: 44px; background-color: #102770; background-image: url('data:image/svg+xml;base64,CjxzdmcgaWQ9IkNhcGFfMSIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAwIDAgNTEyIDUxMiIgaGVpZ2h0PSI1MTIiIHZpZXdCb3g9IjAgMCA1MTIgNTEyIiB3aWR0aD0iNTEyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxnPjxwYXRoIGQ9Im0yMDQuNTI4IDMwNy41NzhjLTc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4IDMuMzQ1IDEzLjc2NC0yLjAyNCAxMi41NTktOS4wNzlsLTYuOTE5LTQwLjQ5NWMtLjQ3Ni0yLjc4OC40NDYtNS42MzMgMi40Ny03LjYxM3oiIGZpbGw9IiNmZWRmMzAiLz48L2c+PC9nPjwvc3ZnPg=='); background-size: 20px 20px; background-repeat: no-repeat; background-position: center; transition: all 200ms linear; opacity: 0; } .dark-light:checked + label:after { opacity: 1; } .dark-light:checked + label:before, .dark-light:not(:checked) + label:before{ position: absolute; content: ''; top: 0; left: 0; overflow: hidden; z-index: 1; display: block; border-radius: 50%; width: 46px; height: 46px; background-color: #48dbfb; background-image: url('data:image/svg+xml;base64,Cjw/eG1sIHZlcnNpb249IjEuMCIgZW5jb2Rpbmc9Imlzby04ODU5LTEiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE5LjAuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCA0MjAgNDIwIiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCA0MjAgNDIwOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+CjxnPgoJPHBvbHlnb24gc3R5bGU9ImZpbGw6I0Y1QzUyNTsiIHBvaW50cz0iNDIwLDIxMCAzNzUuNzc0LDI0Ny44NTcgMzk5LjIzOCwzMDEuMTQ1IDM0Mi45MjYsMzE1Ljk4NiAzNDAuOTQ1LDM3NC4xODQgMjgzLjc2NCwzNjMuMjExIAoJCTI1Ni43MjQsNDE0Ljc3OSAyMTAsMzgwIDE2My4yNzYsNDE0Ljc3OSAxMzYuMjM2LDM2My4yMTEgNzkuMDU1LDM3NC4xODQgNzcuMDczLDMxNS45ODYgMjAuNzYyLDMwMS4xNDQgNDQuMjI2LDI0Ny44NTggMCwyMTAgCgkJNDQuMjI2LDE3Mi4xNDMgMjAuNzYyLDExOC44NTUgNzcuMDc0LDEwNC4wMTQgNzkuMDU1LDQ1LjgxNiAxMzYuMjM2LDU2Ljc4OSAxNjMuMjc2LDUuMjIxIDIxMCw0MCAyNTYuNzIzLDUuMjIxIDI4My43NjQsNTYuNzg5IAoJCTM0MC45NDUsNDUuODE2IDM0Mi45MjcsMTA0LjAxNCAzOTkuMjM4LDExOC44NTYgMzc1Ljc3NCwxNzIuMTQyIAkiLz4KCTxjaXJjbGUgc3R5bGU9ImZpbGw6I0Y4QTgwNTsiIGN4PSIyMTAiIGN5PSIyMTAiIHI9IjE0MCIvPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+Cjwvc3ZnPgo='); background-size: 25px 25px; background-repeat: no-repeat; background-position: center; transition: all 200ms linear; } .dark-light:checked + label:before{ background-color: #000; } .light-back{ position: fixed; top: 0; left: 0; z-index: 1; background-color: #fff; overflow: hidden; background-position: center; background-repeat: repeat; background-size: 4%; height: 100%; width: 100%; transition: all 200ms linear; opacity: 0; } .dark-light:checked ~ .light-back{ opacity: 1; } .dropdown:checked + label, .dropdown:not(:checked) + label{ position: relative; font-family: 'Roboto', sans-serif; font-weight: 500; font-size: 15px; line-height: 2; height: 50px; transition: all 200ms linear; border-radius: 4px; width: 220px; letter-spacing: 1px; display: -webkit-i.........完整代码请登录后点击上方下载按钮下载查看
网友评论0