css实现悬浮展开分享菜单代码

代码语言:html

所属分类:菜单导航

代码描述:css实现悬浮展开分享菜单代码

代码标签: css 悬浮 展开 分享 菜单 代码

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

  <!doctype html>
  <html lang="en">
    <head>
      <meta charset="UTF-8" />
     <style>
         :root {
  --bg-gradient: linear-gradient(
    110deg,
    oklch(58% 0.28 255) 0%,
    oklch(42% 0.34 295) 100%
  );
  --panel-bg: rgba(255, 255, 255, 0.14);
  --panel-border: rgba(255, 255, 255, 0.35);
  --panel-border-hover: rgba(255, 255, 255, 0.5);
  --panel-shadow:
    0 18px 40px rgba(12, 8, 40, 0.35), inset 0 1px 1px rgba(255, 255, 255, 0.3);
  --ink: rgba(255, 255, 255, 0.96);
  --ink-subtle: rgba(255, 255, 255, 0.7);
  --chip-bg: rgba(255, 255, 255, 0.94);
  --chip-ink: #1e1b4b;
  --success-bg: #22c55e;
  --success-ink: #ffffff;
  --tooltip-bg: rgba(15, 10, 30, 0.92);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-gradient);
  font-family:
    "Plus Jakarta Sans",
    system-ui,
    -apple-system,
    sans-serif;
  overflow: hidden;
  position: relative;
}

.stage {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.share-shell {
  position: relative;
  height: 60px;
  width: 148px;
  border-radius: 30px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  box-shadow: var(--panel-shadow);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  overflow: visible;
  will-change: width;
  transition: border-color 0.25s ease;

  &:hover {
    border-color: var(--panel-border-hover);
  }
}

.view {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1);

  &[data-hidden="true"] {
    opacity: 0;
    pointer-events: none;
  }
}

.idle-btn {
  appearance: none;
  border: none;
  background: transparent;
  height: 100%;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  padding: 0 24px;
  border-radius: 30px;
  span, svg {
    transition: transform 0.12s cubic-bezier(0.2, 0.8, 0.25, 1);
  }
  
  &:hover {
    transform: translateY(-2.5%) scale(1.08);

    svg {
      transform: rotate(14deg) scale(1.08) translateY(-2.5%);
    }
  }

  &:active {
    transform: scale(0.97);
  }

  &:focus-visible {
    outline: 2px solid cyan;
    transform: none;
    outline-offset: 3px;
  }

  svg {
    width: 18px;
    height: 18px;
    stroke-width: 2.2;
    transition: transform 0.18s cubic-bezier(0.2, 0.8, 0.25, 1);
  }
}

.icons-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.........完整代码请登录后点击上方下载按钮下载查看

网友评论0