div+css实现粘性导航菜单点击滚动效果代码

代码语言:html

所属分类:菜单导航

代码描述:div+css实现粘性导航菜单点击滚动效果代码

代码标签: div css 粘性 导航 菜单 点击 滚动

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

<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  

  
  
  
  
<style>
html {
  cursor: none;
  --text: #FFF;
  background: #001220;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  font-family: sans-serif;
}

header {
  position: sticky;
  top: 0;
  left: 0;
  z-index: 1;
  padding: 1.5rem;
}

nav {
  width: 100%;
  background-color: rgba(76, 76, 76, 0.36);
  color: black;
  padding: 10px 0;
  text-align: center;
  display: flex;
  justify-content: space-around;
  border-radius: 5rem;
  backdrop-filter: blur(4px);
}

nav ul {
  list-style: none;
  display: flex;
  justify-content: space-between;
  width: 80%;
}
nav ul li {
  font-weight: bold;
}

a {
  text-decoration: none;
  color: var(--text);
}

section {
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

h2 {
  transition: font-size 300ms ease-out;
  font-size: 20vw;
  color: #fff;
  background: -webkit-linear-gradient(45deg, #09009f, #00ff95 80%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  -webkit-box-reflect: below 10px linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.4));
}

@media (min-width: 1200px) {
  h2 {
    font-size: 16.5rem;
  }
}
#press {
  background: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBpZD0idmlzdWFsIiB2aWV3Qm94PSIwIDAgOTAwIDYwMCIgd2lkdGg9IjkwMCIgaGVpZ2h0PSI2MDAiIHZlcnNpb249IjEuMSI+PHBhdGggZD0iTTAgNDc4TDIxLjUgNDcxLjhDNDMgNDY1LjcgODYgNDUzLj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NjAxQzYwMCA2MDEgNTU3IDYwMSA1MTQuMiA2MDFDNDcxLjMgNjAxIDQyOC43IDYwMSAzODUuOCA2MDFDMzQzIDYwMSAzMDAgNjAxIDI1Ny4yIDYwMUMyMTQuMyA2MDEgMTcxLjcgNjAxIDEyOC44IDYwMUM4NiA2MDEgNDMgNjAxIDIxLjUgNjAxTDAgNjAxWiIgZmlsbD0iI2UzNGM2NyIvPjxwYXRoIGQ9Ik0wIDU2MkwyMS41IDU1Ni43QzQzIDU1MS4zIDg2IDU0MC43IDEyOC44IDUzNC4yQzE3MS43IDUyNy43IDIxNC4zIDUyNS4zIDI1Ny4yIDUyNC4zQzMwMCA1MjMuMyAzNDMgNTIzLjcgMzg1LjggNTMwLjdDNDI4LjcgNTM3LjcgNDcxLjMgNTUxLjMgNTE0LjIgNTU2LjJDNTU3IDU2MSA2MDAgNTU3IDY0Mi44IDU1My4zQzY4NS43IDU0OS43IDcyOC4zIDU0Ni4zIDc3MS4yIDU0OC43QzgxNCA1NTEgODU3IDU1OSA4NzguNSA1NjNMOTAwIDU2N0w5MDAgNjAxTDg3OC41IDYwMUM4NTcgNjAxIDgxNCA2MDEgNzcxLjIgNjAxQzcyOC4zIDYwMSA2ODUuNyA2MDEgNjQyLjggNjAxQzYwMCA2MDEgNTU3IDYwMSA1MTQuMiA2MDFDNDcxLjMgNjAxIDQyOC43IDYwMSAzODUuOCA2MDFDMzQzIDYwMSAzMDAgNjAxIDI1Ny4yIDYwMUMyMTQuMyA2MDEgMTcxLjcgNjAxIDEyOC44IDYwMUM4NiA2MDEgNDMgNjAxIDIxLjUgNjAxTDAgNjAxWiIgZmlsbD0iI2M2MjM2OCIvPjwvc3ZnPg==");
  background-position: bottom;
  background-repeat: no-repeat;
  background-size: cover;
}

#shop {
  background: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5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c3ZnPg=="), #c61266;
  background-position: bottom;
  background-repeat: no-repeat;
  background-size: cover;
  background: #c61266;
}
#shop h2 {
  background: -webkit-linear-gradient(0deg, #f97109 0%, #ec9b21 35%, #ffb913 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

#about {
  background: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG.........完整代码请登录后点击上方下载按钮下载查看

网友评论0