js startViewTransition实现明暗色调切换过渡动画切换代码
代码语言:html
所属分类:布局界面
代码描述:js startViewTransition实现明暗色调切换过渡动画切换代码,一共7种过渡切换动画。
代码标签: js startViewTransition 明 暗 色调 切换 过渡 动画 切换 代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
@import url('//repo.bfw.wiki/bfwrepo/css/normalize.5.0.css') layer(normalize);
@layer normalize, base, demo;
@font-face {
font-family: 'Departure Mono';
src: url('//repo.bfw.wiki/bfwrepo/font/DepartureMono-Regular.woff');
}
@layer demo {
.content {
padding: 0rem;
flex: 1;
display: flex;
flex-direction: column;
justify-content: center;
gap: 1rem;
align-items: flex-start;
max-width: 50vw;
align-self: flex-end;
}
a:not(.bear-link) {
padding: 1rem 2rem;
border-radius: 12px;
color: var(--bg);
-webkit-text-decoration-line: none;
text-decoration-line: none;
background: var(--color);
font-weight: bold;
transition: background 0.2s;
}
html {
color-scheme: light dark;
}
[data-theme='light'] {
color-scheme: light only;
}
[data-theme='dark'] {
color-scheme: dark only;
}
[data-theme='dark'] a:is(:hover, :focus-visible) {
background: hsl(0 0% 80%);
}
a:is(:hover, :focus-visible) {
background: hsl(0 0% 50%);
}
.images {
flex: 1;
}
footer {
opacity: 0;
padding: 1rem;
}
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border-width: 0;
}
:root {
--color: hsl(0 0% 6%);
--bg: hsl(0 0% 98%);
}
h1 {
font-family: 'Departure Mono', monospace;
font-size: clamp(2rem, 4vw + 1rem, 8rem);
line-height: 1;
font-weight: 300;
margin: 0;
}
main {
display: flex;
flex: 1;
align-items: center;
padding: 2rem;
gap: 4rem;
max-width: 100vw;
}
pre {
max-width: 100%;
}
p {
width: 60ch;
max-width: 100%;
}
[da.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0