Home >Web Front-end >JS Tutorial >Cared Animated html css
`<
@property --x {
syntax: "
initial-value: 35%;
inherits: false;
}
@property --shine {
syntax: "
initial-value: transparent;
inherits: false;
}
@property --shadow-strength {
syntax: "
initial-value: 0%;
inherits: false;
}
:root {
--h: 240;
--s: 97%;
--l: 50%;
--surface-1: hsl(var(--h) var(--s) calc(var(--l) 4%));
--surface-2: hsl(var(--h) var(--s) calc(var(--l) 8%));
--surface-3: hsl(var(--h) var(--s) calc(var(--l) 12%));
--text: hsl(var(--h) var(--s) 96%);
--text-alt: hsl(var(--h) var(--s) 85%);
--shadow-color: var(--h) var(--s) 15%;
--shadow-strength: 1%;
--shadow: 0 -2px 5px 0 hsl(var(--shadow-color) /
calc(var(--shadow-strength) 2%)),
0 1px 1px -2px hsl(var(--shadow-color) / calc(var(--shadow-strength) 3%)),
0 2px 2px -2px hsl(var(--shadow-color) / calc(var(--shadow-strength) 3%)),
0 5px 5px -2px hsl(var(--shadow-color) / calc(var(--shadow-strength) 4%)),
0 9px 9px -2px hsl(var(--shadow-color) / calc(var(--shadow-strength) 5%)),
0 16px 16px -2px hsl(var(--shadow-color) / calc(var(--shadow-strength) 6%));
--space: 1rem;
}
body {
color: var(--text);
background: var(--surface-1);
padding-inline: var(--space);
font-size: 1.125rem;
line-height: 1.4;
font-family: system-ui, sans-serif;
font-weight: 300;
}
main {
display: grid;
gap: 35vh;
}
.page-section {
container-type: inline-size;
display: grid;
gap: var(--space);
inline-size: min(var(--max, 30rem), 100%);
margin-inline: auto;
}
.page-footer {
margin-block-start: 50vh;
text-align: center;
padding: 2rem;
h2 {
display: grid;
}
h2::before {
content: "";
display: block;
width: 1px;
height: 3rem;
margin-block-end: 0.5rem;
margin-inline: auto;
background: var(--surface-3);
}
}
.icon {
width: 2.5rem;
height: auto;
}
.icon-sm {
width: 1.5rem;
color: var(--text-alt);
}
.text-label {
font-size: 0.8em;
font-weight: 500;
letter-spacing: 0.01em;
}
.author {
text-align: end;
}
.cluster {
display: flex;
align-items: center;
gap: 1rem;
}
.page-headline {
--_margin: 30vh;
margin-block-start: var(--_margin);
text-align: center;
&::after {
content: "";
display: block;
width: 1px;
height: var(--_margin);
margin-block-start: 0.8rem;
margin-inline: auto;
background: var(--surface-3);
}
}
box-gleam {
--_gleam: linear-gradient(
115deg,
transparent 40%,
var(--surface-3),
transparent 70%
)
var(--x) 0 / 600% 100% padding-box;
--_gleam-cover: radial-gradient(
circle at center,
var(--surface-1),
transparent
)
padding-box;
--_cover: linear-gradient(var(--surface-1), var(--surface-1)) padding-box;
--_shine: conic-gradient(
from var(--angle),
var(--shine),
transparent 20% 80%,
var(--shine)
)
border-box;
--_edges: linear-gradient(
155deg,
var(--surface-3),
var(--surface-2) 20% 80%,
var(--surface-3)
)
border-box;
display: grid;
gap: var(--space);
position: relative;
padding: 1.6rem;
border-radius: 0.8rem;
border: 1px solid transparent;
box-shadow: var(--shadow);
background: var(--_gleam-cover), var(--_gleam), var(--_cover), var(--_shine),
var(--_edges);
}
@supports (animation-timeline: view()) {
box-gleam {
animation: linear both;
animation-name: gleam, shine, shadow;
animation-timeline: view();
animation-range: cover -10% cover 100%, entry 0% cover 65%,
entry 0% exit 150%;
}
}
@media (prefers-reduced-motion: reduce) {
box-gleam {
animation: none !important;
}
}
@keyframes gleam {
from {
--angle: -1turn;
--x: 0%;
}
to {
--angle: 1turn;
--x: 100%;
}
}
@keyframes shadow {
from,
to {
box-shadow: none;
}
50%,
65% {
box-shadow: var(--shadow);
}
}
@keyframes shine {
0%,
45% {
--shine: transparent;
}
80% {
--shine: hsl(var(--h) var(--s) calc(var(--l) 38%));
}
}
bento-grid {
display: grid;
gap: var(--space);
- { display: grid; place-items: center; place-content: center; text-align: center; padding: 2.5rem; } }
@container (inline-size > 35rem) {
bento-grid {
grid-template-columns: repeat(var(--col-count, 3), 1fr);
grid-template-rows: repeat(var(--row-count, 3), auto);
<box-gleam> <blockquote> <p>Fantasy is a necessary ingredient in living, it's a way of looking at life through the wrong end of a telescope.</p> </blockquote> <p class="author text-label">Dr. Seuss</p> </box-gleam> <box-gleam> <blockquote> <p>A day without sunshine is like, you know, night.</p> </blockquote> <p class="author text-label">Steve Martin</p> </box-gleam> <box-gleam> <blockquote> <p>I refuse to answer that question on the grounds that I don't know the answer</p> </blockquote> <p class="author text-label">Douglas Adams</p> </box-gleam> <box-gleam> <blockquote> <p>Whatever the problem, be part of the solution. Don’t just sit around raising questions and pointing out obstacles.</p> </blockquote> <p class="author text-label">Tina Fey</p> </box-gleam> <box-gleam> <blockquote> <p>Never memorize something that you can look up.</p> </blockquote> <p class="author text-label">Albert Einstein</p> </box-gleam> <box-gleam> <blockquote> <p>It’s no use going back to yesterday, because I was a different person then.</p> </blockquote> <p class="author text-label">Lewis Carroll</p> </box-gleam> <h2>Chart new territory</h2> <br> <pre class="brush:php;toolbar:false"> <box-gleam> <svg class="icon" aria-hidden="true" width="15" height="15" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M12.3536 1.14645C12.1583 0.951184 11.8417 0.951184 11.6464 1.14645C11.4512 1.34171 11.4512 1.65829 11.6464 1.85355L12.7929 3H12C10.7037 3 9.71111 3.58423 8.87248 4.38931C8.20065 5.03427 7.59349 5.85684 6.99461 6.6682C6.86287 6.84668 6.73154 7.02462 6.6 7.2C5.10874 9.18835 3.49037 11 0.5 11C0.223858 11 0 11.2239 0 11.5C0 11.7761 0.223858 12 0.5 12C4.00963 12 5.89126 9.81165 7.4 7.8C7.54367 7.60845 7.6832 7.41962 7.81996 7.23454L7.82005 7.23443L7.82006 7.23441C8.41674 6.42695 8.96069 5.69085 9.56502 5.11069C10.2889 4.41577 11.0463 4 12 4H12.7929L11.6464 5.14645C11.4512 5.34171 11.4512 5.65829 11.6464 5.85355C11.8417 6.04882 12.1583 6.04882 12.3536 5.85355L14.3536 3.85355C14.5488 3.65829 14.5488 3.34171 14.3536 3.14645L12.3536 1.14645ZM0.5 3C3.35278 3 5.12992 4.44588 6.50548 6.06746L6.3762 6.24266C6.2483 6.4161 6.12293 6.58609 6 6.75C5.96397 6.79804 5.92798 6.84581 5.892 6.89331C4.57348 5.29306 3.02637 4 0.5 4C0.223858 4 0 3.77614 0 3.5C0 3.22386 0.223858 3 0.5 3ZM8.87248 10.6107C8.37284 10.131 7.90897 9.55314 7.45767 8.95468C7.64688 8.71693 7.82704 8.48061 8 8.25L8.08987 8.12987C8.58412 8.79402 9.05288 9.39766 9.56502 9.88931C10.2889 10.5842 11.0463 11 12 11H12.7929L11.6464 9.85355C11.4512 9.65829 11.4512 9.34171 11.6464 9.14645C11.8417 8.95118 12.1583 8.95118 12.3536 9.14645L14.3536 11.1464C14.5488 11.3417 14.5488 11.6583 14.3536 11.8536L12.3536 13.8536C12.1583 14.0488 11.8417 14.0488 11.6464 13.8536C11.4512 13.6583 11.4512 13.3417 11.6464 13.1464L12.7929 12H12C10.7037 12 9.71111 11.4158 8.87248 10.6107Z" fill="currentColor" fill-rule="evenodd" clip-rule="evenodd"></path> </svg> <h2 class="text-label">Shuffle the beat</h2> </box-gleam> <box-gleam> <h2>Thanks for the scrolls</h2> <br><br> <br><br> <br><br> <br><br> `
The above is the detailed content of Cared Animated html css. For more information, please follow other related articles on the PHP Chinese website!