css实现页面滚动左侧导航指示文字变动效果代码
代码语言:html
所属分类:加载滚动
代码描述:css实现页面滚动左侧导航指示文字变动效果代码
代码标签: css 页面 滚动 左侧 导航 指示 文字 变动
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
@import url('https://fonts.googleapis.com/css2?family=Gloria+Hallelujah&display=swap');
/* @import url('https://unpkg.com/normalize.css') layer(normalize); */
@import 'normalize.css' layer(normalize);
@layer normalize, base, demo;
@layer demo {
:root {
--heading: 35svh;
timeline-scope: --main;
}
header a {
padding: 1rem 2rem;
border-radius: 100px;
background: linear-gradient(68deg, hsl(45 80% 60%), orange);
text-decoration: none;
color: hsl(0 0% 10%);
font-weight: 600;
}
.arrow {
position: absolute;
left: 90%;
top: calc(100% + 1rem);
width: 70px;
z-index: 9999;
font-size: 14px;
}
.arrow svg {
scale: 1 1;
rotate: -90deg;
}
.arrow span {
position: absolute;
font-family: 'Gloria Hallelujah', cursive;
rotate: -10deg;
left: 0%;
top: 105%;
white-space: nowrap;
}
body {
-webkit-animation: indicate both steps(2);
animation: indicate both steps(2);
animation-timeline: --main;
animation-range: entry 50% exit 0%;
counter-set: section var(--section);
}
main::after {
content: 'Debug: ' counter(section);
position: fixed;
pointer-events: none;
top: 6rem;
right: 0.25rem;
background: color-mix(in hsl, canvasText, canvas 20%);
color: canvas;
padding: 1rem;
border-radius: 12px;
border: 4px double canvas;
font-size: 14px;
font-family: monospace;
font-weight: 500;
opacity: 0;
transition: opacity 0.25s;
}
[data-debug='true'] main::after {
opacity: 1;
}
@property --section {
inherits: true;
syntax: '<integer>';
initial-value: 0;
}
@-webkit-keyframes indicate {
to {
--section: 2;
}
}
@keyframes indicate {
to {
--section: 2;
}
}
header {
display: grid;
place-items: center;
align-content: end;
height: 50svh;
}
.........完整代码请登录后点击上方下载按钮下载查看
网友评论0