js+css实现粘性菜单导航滚动个人主页效果代码
代码语言:html
所属分类:布局界面
代码描述:js+css实现粘性菜单导航滚动个人主页效果代码,大气全屏图片结合文字和粘性菜单导航滚动效果让你的主页展示更个性时尚。
代码标签: js css 粘性 菜单 导航 滚动 个人 主页
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> @import url('https://fonts.googleapis.com/css2?family=Victor+Mono&display=swap'); * { margin: 0; padding: 0; box-sizing: border-box; } html { scroll-behavior: smooth; } body { min-height: 120vh; --primary: #38d4e2; } .container { height: max-content; } header { width: 100%; height: 50dvh; background-size: cover; background-image: url('//repo.bfw.wiki/bfwrepo/image/601cfc0c957d7.png'); display: grid; place-items: center; text-align: center; } header h1 { font-size: 6rem; font-family: "Victor Mono", sans-serif; text-transform: uppercase; color: var(--primary); text-shadow: 1px 1px 7px rgba(0,0,0,0.2); } header h3 { font-size: 2rem; font-family: "Victor Mono", sans-serif; text-transform: uppercase; background-color: var(--primary); } section { width: 100%; height: 100vh; display: grid; place-items: center; background-size: cover; background-position: 50% 50%; border-bottom: 1px dotted #1c303a; } section h1 { font-family: "Victor Mono", sans-serif; font-size: 4rem; color: var(--primary); text-transform: uppercase; letter-spacing: 0.5rem; text-shadow: 1px 1px 8px rgba(0,0,0,0.5); } section:last-child() { border-bottom: none; } section#portfolio { background-image: url('//repo.bfw.wiki/bfwrepo/image/601cfc2e3f218.png'); } section#press { background-image: url('//repo.bfw.wiki/bfwrepo/image/601cfdea1ec90.png'); } section#shop { background-image: url('//repo.bfw.wiki/bfwrepo/image/601cfe57036c7.png'); } section#about { background-image: url('//repo.bfw.wiki/bfwrepo/image/601cfeba80ae1.png'); } a { display: inline-block; text-align: center; text-decoration: none; text-transform: uppercase; font-family: "Victor Mono"; font-size: 0.8rem; letter-spacing: 3px; color: var(--primary); } .nav-bar { height: 6em; width: 100%; display: grid; place-items: center; position: sticky; top: 0; background-color: rgba(20, 33, 40, 0.9); } .nav-bar nav { width: max-content; display: grid; grid-template-columns: repeat(4, auto); align-items: center; column-gap: 1em; } .nav { padding: 0.2em 0.4em; position: relative; filter: brightness(90%); } .nav span.grow { content: ""; display: block; position: absolute; top: 50%; left: 0; transform: translateY(-50%); width: 0%; height: 100%; background-color: var(--primary); mix-blend-mode: difference; transition: width 0.2s .........完整代码请登录后点击上方下载按钮下载查看
网友评论0