js+css实现弹性伸缩tab选项卡切换动画效果代码
代码语言:html
所属分类:选项卡
代码描述:js+css实现弹性伸缩tab选项卡切换动画效果代码
代码标签: js css 弹性 伸缩 tab 选项卡 切换 动画
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> * { box-sizing: border-box; } body { padding: 0; margin: 0; background: hsl(270.2, 50%, 8%); display: flex; align-items: center; justify-content: center; min-height: 100vh; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } .tabs { --tab-width: 100px; --tab-height: 30px; --tab-border-radius: 5px; background: hsl(270.2, 100%, 3.5%); border-radius: 5px; padding: 8px 8px; display: flex; gap: 0 20px; position: relative; overflow: hidden; outline: 1px solid hsl(270.2, 50%, 10%); } .tab, .active-tab { --tab-text-color: hsl(247.2, 10%, 40%); color: var(--tab-text-color); font-size: 14px; font-weight: 700; -webkit-user-select: none; user-select: none; line-height: 0; font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; width: var(--tab-width); height: var(--tab-height); display: flex; align-items: center; justify-content: center; text-align: center; position: relative; z-index: 1; cursor: pointer; } .active-tab { position: absolute; z-index: 3; pointer-events: none; } .switcher { opacity: 0.5; position: absolute; z-index: 2; width: var(--tab-width); height: var(--tab-height); background: hsl(270.2, 100%, 80%); border-radius: var(--tab-border-radius); touch-action: none; cursor: pointer; }.........完整代码请登录后点击上方下载按钮下载查看
网友评论0