DevPlatform
Home
Components
Search
Submit
Earn
Login
Sign Up Free
Tilt Card - Preview | DevPlatform
DevPlatform
Categories
Accordion
Animation
Box Shadow
Button
Card
Footer
Form
Gallery
Hero Section
Inputs
Loader
Marquee
Modal
Modules
Navbar
Progress Bar
Radio Buttons
Search-Bar
Sections
Slider
Tab
Timeline
Toggle
Tilt Card
abhishek001
Jan 25, 2026
4
0
Share
Live Preview
Refresh
Live Editor
HTML
CSS
JS
HTML
CSS
JavaScript
1
<div class="container"> <div class="card" id="tiltCard"> <div class="card-icon">🚀</div> <h3 class="card-title">Interactive Tilt</h3> <p class="card-description"> Move your mouse over this card to see the 3D tilt effect. The elements have different depths creating a parallax effect. </p> <button class="card-btn"> <span>Learn More</span> <span>→</span> </button> </div> </div>
1
* { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 2rem; } .container { max-width: 450px; width: 100%; } h1 { text-align: center; color: white; font-size: 2.5rem; margin-bottom: 3rem; text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2); } .card { position: relative; background: white; border-radius: 20px; padding: 2.5rem; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); transition: all 0.3s ease; transform-style: preserve-3d; cursor: pointer; } .card-icon { width: 80px; height: 80px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); border-radius: 16px; display: flex; align-items: center; justify-content: center; font-size: 2.5rem; margin-bottom: 1.5rem; box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4); transform: translateZ(50px); transition: transform 0.3s ease; } .card:hover .card-icon { transform: translateZ(80px); } .card-title { font-size: 1.75rem; font-weight: 700; color: #1a202c; margin-bottom: 1rem; transform: translateZ(30px); transition: transform 0.3s ease; } .card:hover .card-title { transform: translateZ(50px); } .card-description { color: #718096; line-height: 1.7; margin-bottom: 1.5rem; transform: translateZ(20px); transition: transform 0.3s ease; } .card:hover .card-description { transform: translateZ(40px); } .card-btn { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.875rem 1.75rem; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; border: none; border-radius: 10px; font-weight: 600; font-size: 1rem; cursor: pointer; transition: all 0.3s ease; transform: translateZ(40px); } .card-btn:hover { transform: translateZ(60px) scale(1.05); box-shadow: 0 10px 25px rgba(102, 126, 234, 0.5); } @media (max-width: 768px) { h1 { font-size: 2rem; margin-bottom: 2rem; } .card { padding: 2rem; } }
1
const card = document.getElementById('tiltCard'); card.addEventListener('mousemove', (e) => { const rect = card.getBoundingClientRect(); const x = e.clientX - rect.left; const y = e.clientY - rect.top; const centerX = rect.width / 2; const centerY = rect.height / 2; const rotateX = (y - centerY) / 10; const rotateY = (centerX - x) / 10; card.style.transform = `perspective(1000px) rotateX(${rotateX}deg) rotateY(${rotateY}deg) scale(1.05)`; }); card.addEventListener('mouseleave', () => { card.style.transform = 'perspective(1000px) rotateX(0) rotateY(0) scale(1)'; });
Comments
0
Want to comment?
Please
login
or
sign up
to post comments.
No comments yet
Be the first to comment on this component!
Comments 0
Want to comment?
Please login or sign up to post comments.
No comments yet
Be the first to comment on this component!