A tear-off desk calendar: every page lifts off the top and flips away, uncovering the next date and weekday. Day and weekday are counters over one integer, each with its own cyclic @counter-style.
Also known as: calendar flip animation, tear off calendar css, date change animation.
<div class="txt-calendar-date-flip" aria-label="Calendar"> <span class="txt-calendar-date-flip-page txt-calendar-date-flip-next" aria-hidden="true"><em>Sep</em><b></b><i></i></span> <span class="txt-calendar-date-flip-page txt-calendar-date-flip-now" aria-hidden="true"><em>Sep</em><b></b><i></i></span> </div>
@counter-style txt-calendar-date-flip-day {
system: cyclic;
symbols: "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "30";
}
/* September 1, 2026 is a Tuesday */
@counter-style txt-calendar-date-flip-weekday {
system: cyclic;
symbols: "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday" "Sunday" "Monday";
}
@property --txt-calendar-date-flip-d {
syntax: "<integer>";
initial-value: 0;
inherits: false;
}
.txt-calendar-date-flip {
--c: var(--txt-color, #3b82f6);
font-size: calc(var(--txt-size, 32px) * 1.3);
font-family: system-ui, sans-serif;
font-weight: 700;
line-height: 1.2;
position: relative;
width: 3.2em;
height: 3.5em;
perspective: 8em;
--flip: 1.6s;
/* starts on the 12th */
counter-reset: txt-calendar-date-flip-now calc(var(--txt-calendar-date-flip-d) + 12) txt-calendar-date-flip-next calc(var(--txt-calendar-date-flip-d) + 13);
animation: txt-calendar-date-flip-count calc(var(--flip) * 30) steps(30) infinite;}
/* the binding strip and its two rings */
.txt-calendar-date-flip::before {
content: "";
position: absolute;
inset: 0 0 auto;
z-index: 2;
height: 0.55em;
border-radius: 0.28em 0.28em 0 0;
background:
radial-gradient(circle at 28% 50%, color-mix(in srgb, var(--c) 45%, #000) 0.07em, transparent 0.08em),
radial-gradient(circle at 72% 50%, color-mix(in srgb, var(--c) 45%, #000) 0.07em, transparent 0.08em),
var(--c);
}
.txt-calendar-date-flip-page {
position: absolute;
inset: 0.55em 0 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
line-height: 1;
border-radius: 0 0 0.28em 0.28em;
background: #fff;
color: #1f2937;
box-shadow: 0 0.1em 0.3em -0.1em rgb(0 0 0 / 0.35), inset 0 0 0 1px rgb(0 0 0 / 0.06);
}
.txt-calendar-date-flip-page em {
font-size: 0.4em;
font-style: normal;
font-weight: 800;
letter-spacing: 0.14em;
text-transform: uppercase;
color: var(--c);
}
.txt-calendar-date-flip-page b {
font-size: 1.45em;
font-weight: 800;
letter-spacing: -0.03em;
}
.txt-calendar-date-flip-page i {
font-size: 0.34em;
font-style: normal;
font-weight: 600;
color: #6b7280;
}
.txt-calendar-date-flip-now b::after { content: counter(txt-calendar-date-flip-now, txt-calendar-date-flip-day); }
.txt-calendar-date-flip-now i::after { content: counter(txt-calendar-date-flip-now, txt-calendar-date-flip-weekday); }
.txt-calendar-date-flip-next b::after { content: counter(txt-calendar-date-flip-next, txt-calendar-date-flip-day); }
.txt-calendar-date-flip-next i::after { content: counter(txt-calendar-date-flip-next, txt-calendar-date-flip-weekday); }
.txt-calendar-date-flip-now {
z-index: 1;
transform-origin: top;
backface-visibility: hidden;
animation: txt-calendar-date-flip-tear var(--flip) infinite;
}
@keyframes txt-calendar-date-flip-count {
to { --txt-calendar-date-flip-d: 30; }
}
@keyframes txt-calendar-date-flip-tear {
0%, 55% { transform: rotateX(0); opacity: 1; animation-timing-function: cubic-bezier(0.5, 0, 0.75, 0); }
92% { opacity: 1; }
100% { transform: rotateX(-110deg); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
.txt-calendar-date-flip, .txt-calendar-date-flip *, .txt-calendar-date-flip::before, .txt-calendar-date-flip::after, .txt-calendar-date-flip *::before, .txt-calendar-date-flip *::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
}
}--txt-color on the element or a parent.
Currently previewing #3b82f6.--txt-size. Every other dimension is in
em, so the whole thing scales together. Currently previewing 40px.transition or animation
shorthand. Staggered delays are relative, so they keep their rhythm.