css+js实现按钮悬浮水滴文字背景混合交错对比效果代码
代码语言:html
所属分类:悬停
代码描述:css+js实现按钮悬浮水滴文字背景混合交错对比效果代码
代码标签: css js 按钮 悬浮 水滴 文字 背景 混合 交错 对比
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> * { box-sizing: border-box; } :root { --bg: hsl(0 0% 6%); --fg: hsl(0 0% 90%); } body { display: grid; place-items: center; min-height: 100vh; align-content: center; gap: 1rem; background: var(--bg); } button { --button-bg: var(--bg); --button-fg: var(--fg); --hover-bg: var(--fg); color: var(--button-fg); font-family: sans-serif; padding: 1rem 2rem; border-radius: 100px; border: 2px solid var(--button-fg); background: var(--button-bg); cursor: pointer; touch-action: none; position: relative; overflow: hidden; } button:nth-of-type(2) { --button-bg: var(--fg); --hover-bg: var(--fg); color: var(--bg); } button .back { position: absolute; inset: 0; pointer-events: none; overflow: hidden; border-radius.........完整代码请登录后点击上方下载按钮下载查看
网友评论0