Modern CSS Transform Effects
2D and 3D transforms - tilts, cubes, perspective and chained motion - driven only by hover and keyframes.
1Perspective Text
Lays a heading back in 3D perspective with depth layers; it stands up straight on hover. Class: fx-perspective-text
Big ideas
<div class="d-flex flex-wrap align-items-center justify-content-center gap-3 p-3 h-100" style="min-height:200px">
<h2 class="display-5 fw-bold text-uppercase mb-0 fx-perspective-text">Big ideas</h2>
</div>
/* CSS (already in assets/css/effects.css) */
.fx-perspective-text {
display: inline-block; transform: perspective(500px) rotateX(28deg); transform-origin: 50% 100%;
text-shadow: 0 1px 0 rgba(var(--wt-primary-rgb), .6), 0 2px 0 rgba(var(--wt-primary-rgb), .5), 0 3px 0 rgba(var(--wt-primary-rgb), .4), 0 10px 14px rgba(0, 0, 0, .25);
transition: transform .6s cubic-bezier(.2, .8, .2, 1);
}
.fx-perspective-text:hover { transform: perspective(500px) rotateX(0deg); }
@media (prefers-reduced-motion: reduce) {
.fx-perspective-text, .fx-perspective-text::before, .fx-perspective-text::after, .fx-perspective-text *, .fx-perspective-text *::before, .fx-perspective-text *::after { animation: none !important; transition: none !important; }
}2Translate 3D
Stacked layers separate along the Z axis on hover, like an exploded view of your interface. Class: fx-translate-3d
Hover me
<div class="d-flex flex-wrap align-items-center justify-content-center gap-3 p-3 h-100" style="min-height:200px">
<div class="fx-translate-3d" style="width:150px;height:110px">
<div class="position-absolute top-0 start-0 w-100 h-100 rounded-3 border bg-body-tertiary">
</div>
<div class="position-absolute top-0 start-0 w-100 h-100 rounded-3" style="background:rgba(var(--wt-secondary-rgb), .45)">
</div>
<div class="position-absolute top-0 start-0 w-100 h-100 rounded-3" style="background:rgba(var(--wt-primary-rgb), .55)">
</div>
<div class="position-absolute top-0 start-0 w-100 h-100 rounded-3 d-grid text-white fw-semibold" style="place-items:center">
Hover me
</div>
</div>
</div>
/* CSS (already in assets/css/effects.css) */
.fx-translate-3d { position: relative; transform-style: preserve-3d; transform: perspective(800px); transition: transform .6s cubic-bezier(.2, .8, .2, 1); }
.fx-translate-3d > * { transition: transform .6s cubic-bezier(.2, .8, .2, 1); }
.fx-translate-3d:hover { transform: perspective(800px) rotateX(48deg) rotateZ(-28deg); }
.fx-translate-3d:hover > :nth-child(1) { transform: translate3d(0, 0, 0); }
.fx-translate-3d:hover > :nth-child(2) { transform: translate3d(0, 0, 30px); }
.fx-translate-3d:hover > :nth-child(3) { transform: translate3d(0, 0, 60px); }
.fx-translate-3d:hover > :nth-child(4) { transform: translate3d(0, 0, 90px); }
@media (prefers-reduced-motion: reduce) {
.fx-translate-3d, .fx-translate-3d::before, .fx-translate-3d::after, .fx-translate-3d *, .fx-translate-3d *::before, .fx-translate-3d *::after { animation: none !important; transition: none !important; }
}3Transform Chain
Chains translate, rotate and scale as separate properties with staggered timing for a lively hover. Class: fx-transform-chain
How to choose the right service
$57.25
<div class="d-flex flex-wrap align-items-center justify-content-center gap-3 p-3 h-100" style="min-height:200px">
<div class="card border-0 shadow-sm fx-transform-chain" style="width:12rem">
<img src="https://images.unsplash.com/photo-1584516150909-c43483ee7932?auto=format&fit=crop&w=1200&h=800&q=70" alt="Card cover" class="card-img-top object-fit-cover" style="height:100px">
<div class="card-body py-2">
<h3 class="h6 mb-0">How to choose the right service</h3>
<p class="small text-body-secondary mb-0">$57.25</p>
</div>
</div>
</div>
/* CSS (already in assets/css/effects.css) */
.fx-transform-chain { transition: translate .3s ease, rotate .5s cubic-bezier(.34, 1.56, .64, 1) .08s, scale .4s ease .16s; }
.fx-transform-chain:hover, .fx-transform-chain:focus-visible { translate: 0 -8px; rotate: -3deg; scale: 1.06; }
@supports not (translate: 0) {
.fx-transform-chain { transition: transform .4s cubic-bezier(.34, 1.56, .64, 1); }
.fx-transform-chain:hover, .fx-transform-chain:focus-visible { transform: translateY(-8px) rotate(-3deg) scale(1.06); }
}
@media (prefers-reduced-motion: reduce) {
.fx-transform-chain, .fx-transform-chain::before, .fx-transform-chain::after, .fx-transform-chain *, .fx-transform-chain *::before, .fx-transform-chain *::after { animation: none !important; transition: none !important; }
}