Scroll · 17 of 34
Letter Spacing
Letters start spread wide and tighten into normal spacing as the text fades in. Animates letter-spacing, a cheap way to add a typographic entrance.
<section class="letter-spacing-section">
<h2 class="letter-spacing-text">Letter Spacing</h2>
</section>
.letter-spacing-section {
min-height: 35vh;
display: flex;
align-items: center;
justify-content: center;
}
.letter-spacing-text {
font-size: 2.5rem;
color: #f0f0f5;
letter-spacing: 0.5em;
opacity: 0;
transition: letter-spacing 0.8s cubic-bezier(0.16, 1, 0.3, 1),
opacity 0.6s;
}
.letter-spacing-section.in-view .letter-spacing-text {
letter-spacing: -0.02em;
opacity: 1;
}
var section = document.querySelector('.letter-spacing-section');
new IntersectionObserver(function (entries) {
entries.forEach(function (entry) {
entry.target.classList.toggle('in-view', entry.isIntersecting);
});
}, { threshold: 0.25 }).observe(section);