Window Into Space Card
A card that is a thick frame, with content existing deep inside, far behind the surface plane. Hover tilts the entire card, changing the angle of view into the deep space. Clicking reaches in and pulls a specific content element to the foreground. Parallax particles drift between the foreground frame and the deep background.
by FreeCsStyles Dev's
Embed this component
Paste this snippet into any site — the design renders in a sandboxed iframe served from /embed/window-into-space-card.
<iframe src="/embed/window-into-space-card" sandbox="allow-scripts" loading="lazy" title="Window Into Space Card" style="border:0;width:100%;height:480px;overflow:hidden"></iframe>Implementation code
Copy the HTML and CSS for Window Into Space Card, or grab a framework-specific implementation. The HTML and CSS variants are self-contained; framework variants assume that framework's project setup.
HTML
<div class="window-into-space-card">
<div class="space-deep-bg"></div>
<div class="space-stars"></div>
<div class="space-objects">
<div class="space-object" data-id="0">🌌</div>
<div class="space-object" data-id="1">⭐</div>
<div class="space-object" data-id="2">☄️</div>
<div class="space-object" data-id="3">🕳️</div>
</div>
<div class="space-frame"></div>
<div class="space-content">
<div class="space-header">
<div><div class="space-title">Deep Field View</div><div class="space-sub">Distance: 13.2B ly</div></div>
<div class="space-badge">OBSERVE</div>
</div>
<div class="space-grid">
<div class="space-stat"><div class="space-stat-val">~2,400</div><div class="space-stat-lbl">Stars</div></div>
<div class="space-stat"><div class="space-stat-val">4 objects</div><div class="space-stat-lbl">Deep Space</div></div>
</div>
<div class="space-hint">[▼ click object to retrieve]</div>
</div>
</div>CSS
.window-into-space-card { position: relative; width: 220px; min-height: 300px; border-radius: 16px; overflow: hidden; background: linear-gradient(160deg, #0a0414, #04020a); border: 2.5px solid rgba(168,85,247,0.2); box-shadow: 0 10px 30px rgba(0,0,0,0.3); cursor: default; }
.window-into-space-card:hover { box-shadow: 0 0 30px rgba(168,85,247,0.12), 0 15px 40px rgba(0,0,0,0.4); }
.space-deep-bg { position: absolute; inset: 0; z-index: 1; background: radial-gradient(ellipse at 50% 50%, rgba(30,10,60,0.5), transparent 70%); }
.space-stars { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.space-objects { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.space-object { position: absolute; font-size: 16px; cursor: pointer; transform: translate(-50%,-50%); transition: all 0.5s cubic-bezier(0.22, 1, 0.36, 1); filter: brightness(0.7); }
.space-object:hover { filter: brightness(1.2); transform: translate(-50%,-50%) scale(1.3); }
.space-object[data-id="0"] { left: 30%; top: 35%; } .space-object[data-id="1"] { left: 65%; top: 25%; }
.space-object[data-id="2"] { left: 72%; top: 55%; } .space-object[data-id="3"] { left: 45%; top: 50%; }
.space-frame { position: absolute; inset: 0; z-index: 5; pointer-events: none; border-radius: 16px; box-shadow: inset 0 0 0 8px rgba(0,0,0,0.3), inset 0 0 0 9px rgba(168,85,247,0.18), inset 0 0 20px rgba(0,0,0,0.4); }
.space-content { position: absolute; inset-x: 0; bottom: 0; z-index: 10; padding: 20px; background: linear-gradient(0deg, rgba(0,0,0,0.6), transparent); }
.space-header { display: flex; justify-content: space-between; align-items: center; }
.space-title { font-size: 14px; font-weight: 700; color: rgba(255,255,255,0.9); }
.space-sub { font-size: 9px; color: rgba(168,85,247,0.44); }
.space-badge { padding: 2px 8px; border-radius: 2px; font-size: 7px; font-weight: 700; letter-spacing: 0.1em; color: #a855f7; background: rgba(168,85,247,0.06); border: 1px solid rgba(168,85,247,0.12); }
.space-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.space-stat { text-align: center; padding: 6px 4px; border-radius: 8px; background: rgba(168,85,247,0.04); border: 1px solid rgba(168,85,247,0.06); }
.space-stat-val { font-size: 10px; font-weight: 600; color: #a855f7; }
.space-stat-lbl { font-size: 7px; margin-top: 2px; color: rgba(255,255,255,0.2); }
.space-hint { text-align: center; margin-top: 8px; font-size: 7px; font-family: monospace; color: rgba(168,85,247,0.2); }
@media (prefers-reduced-motion: reduce) { .window-into-space-card:hover .space-object { filter: brightness(0.7) !important; transform: translate(-50%,-50%) !important; } }Tailwind CSS
<div class="group relative w-[220px] min-h-[300px] rounded-2xl overflow-hidden border-2 border-purple-500/40 shadow-lg group-hover:shadow-[0_0_30px_rgba(168,85,247,0.12),0_15px_40px_rgba(0,0,0,0.4)] bg-gradient-to-b from-[#0a0414] to-[#04020a]">
<div class="absolute inset-0 z-[1] bg-gradient-radial from-purple-950/50 to-transparent opacity-70"></div>
<div class="absolute z-[3] text-base cursor-pointer hover:scale-125 transition-transform" style="left:30%;top:35%;">🌌</div>
<div class="absolute z-[3] text-base cursor-pointer hover:scale-125 transition-transform" style="left:65%;top:25%;">⭐</div>
<div class="absolute z-[3] text-base cursor-pointer hover:scale-125 transition-transform" style="left:72%;top:55%;">☄️</div>
<div class="absolute z-[3] text-base cursor-pointer hover:scale-125 transition-transform" style="left:45%;top:50%;">🕳️</div>
<div class="absolute inset-0 z-[5] pointer-events-none rounded-2xl" style="box-shadow:inset 0 0 0 8px rgba(0,0,0,0.3),inset 0 0 0 9px rgba(168,85,247,0.18),inset 0 0 20px rgba(0,0,0,0.4)"></div>
<div class="absolute inset-x-0 bottom-0 z-10 p-5 space-y-2 bg-gradient-to-t from-black/60 to-transparent">
<div class="flex items-center justify-between">
<div><p class="text-sm font-bold text-white/90">Deep Field View</p><p class="text-[9px] text-purple-500/50">Distance: 13.2B ly</p></div>
<div class="px-2 py-0.5 rounded-sm text-[7px] font-bold tracking-widest text-purple-400 bg-purple-500/10 border border-purple-500/20">OBSERVE</div>
</div>
<div class="h-px bg-gradient-to-r from-transparent via-purple-500/10 to-transparent"></div>
<div class="grid grid-cols-2 gap-2">
<div class="text-center py-1.5 rounded-lg bg-purple-500/10 border border-purple-500/20"><p class="text-[10px] font-semibold text-purple-400">~2,400</p><p class="text-[7px] mt-0.5 text-white/20">Stars</p></div>
<div class="text-center py-1.5 rounded-lg bg-purple-500/10 border border-purple-500/20"><p class="text-[10px] font-semibold text-purple-400">4 objects</p><p class="text-[7px] mt-0.5 text-white/20">Deep Space</p></div>
</div>
<div class="text-center"><span class="text-[7px] font-mono text-purple-500/30">[▼ click object to retrieve]</span></div>
</div>
</div>React
import React, { useState, useRef, useCallback } from 'react';
import { motion, useMotionValue, useSpring } from 'framer-motion';
export function WindowIntoSpaceCard({ windowName = 'Deep Field View', starCount = '~2,400', width = 220 }) {
const [isHovered, setIsHovered] = useState(false);
const [pulledObject, setPulledObject] = useState(null);
const ref = useRef(null);
const x = useMotionValue(0);
const y = useMotionValue(0);
const rotateX = useSpring(y, { damping: 25, stiffness: 200 });
const rotateY = useSpring(x, { damping: 25, stiffness: 200 });
const objects = [{ id: 0, name: 'Nebula', x: 30, y: 35, emoji: '🌌', d: 5.2 }, { id: 1, name: 'Pulsar', x: 65, y: 25, emoji: '⭐', d: 8.1 }, { id: 2, name: 'Comet', x: 72, y: 55, emoji: '☄️', d: 3.7 }, { id: 3, name: 'Black Hole', x: 45, y: 50, emoji: '🕳️', d: 12.5 }];
const handleMouseMove = (e) => {
if (!ref.current) return;
const rect = ref.current.getBoundingClientRect();
x.set(-((e.clientX - rect.left - rect.width / 2) / (rect.width / 2)) * 12);
y.set(((e.clientY - rect.top - rect.height / 2) / (rect.height / 2)) * 12);
};
return (
<div onMouseEnter={() => setIsHovered(true)} onMouseLeave={() => { setIsHovered(false); x.set(0); y.set(0); }}>
<motion.div ref={ref} onMouseMove={handleMouseMove} style={{ rotateX, rotateY, transformStyle: 'preserve-3d' }} className="relative cursor-pointer">
<motion.div className="relative overflow-hidden rounded-2xl" style={{ width, minHeight: 300, background: 'linear-gradient(160deg, #0a0414, #04020a)', border: '2.5px solid rgba(168,85,247,0.2)' }}
animate={{ boxShadow: isHovered ? '0 0 30px rgba(168,85,247,0.12), 0 15px 40px rgba(0,0,0,0.4)' : '0 10px 30px rgba(0,0,0,0.3)' }} transition={{ type: 'spring', stiffness: 260, damping: 20 }}>
<div className="absolute inset-0 z-[1]" style={{ background: 'radial-gradient(ellipse at 50% 50%, rgba(30,10,60,0.5), transparent 70%)' }} />
{Array.from({ length: 30 }).map((_, i) => (
<motion.div key={i} className="absolute rounded-full" style={{ left: (5 + Math.random() * 90) + '%', top: (5 + Math.random() * 70) + '%', width: (1 + Math.random() * 2.5), height: (1 + Math.random() * 2.5), background: 'rgba(255,255,255,0.6)', boxShadow: '0 0 4px rgba(255,255,255,0.4)' }}
animate={{ opacity: [0.3, 0.8, 0.3], scale: isHovered ? 1.3 : 1 }} transition={{ duration: 1 + Math.random() * 3, repeat: Infinity, delay: Math.random() * 5 }} />
))}
{objects.map((obj) => (
<motion.div key={obj.id} className="absolute cursor-pointer" style={{ left: obj.x + '%', top: obj.y + '%', transform: 'translate(-50%,-50%)' }}
onClick={(e) => { e.stopPropagation(); setPulledObject(pulledObject === obj.id ? null : obj.id); }}
animate={{ scale: pulledObject === obj.id ? 1.8 : 1, filter: pulledObject === obj.id ? 'brightness(1.5)' : 'brightness(0.7)' }}
transition={{ type: 'spring', stiffness: 200, damping: 15 }}>
<span className="text-base">{obj.emoji}</span>
{pulledObject === obj.id && <motion.span className="text-[6px] font-bold block text-center" style={{ color: '#a855f7' }}>{obj.name}</motion.span>}
</motion.div>
))}
<div className="absolute inset-0 z-[5] pointer-events-none rounded-2xl" style={{ boxShadow: 'inset 0 0 0 8px rgba(0,0,0,0.3), inset 0 0 0 9px rgba(168,85,247,0.18), inset 0 0 20px rgba(0,0,0,0.4)' }} />
<div className="absolute inset-x-0 bottom-0 z-10 p-5 space-y-2" style={{ background: 'linear-gradient(0deg, rgba(0,0,0,0.6), transparent)' }}>
<div className="flex items-center justify-between">
<div><p className="text-sm font-bold" style={{ color: 'rgba(255,255,255,0.9)' }}>{windowName}</p><p className="text-[9px]" style={{ color: 'rgba(168,85,247,0.44)' }}>Distance: 13.2B ly</p></div>
<div className="px-2 py-0.5 rounded-sm text-[7px] font-bold tracking-widest" style={{ background: 'rgba(168,85,247,0.06)', border: '1px solid rgba(168,85,247,0.12)', color: '#a855f7' }}>{pulledObject !== null ? 'RETRIEVED' : 'OBSERVE'}</div>
</div>
<div className="text-center"><span className="text-[7px] font-mono" style={{ color: 'rgba(168,85,247,0.2)' }}>{pulledObject !== null ? '[▼ click to release]' : '[▼ click object to retrieve]'}</span></div>
</div>
</motion.div>
</motion.div>
</div>
);
}Where Window Into Space Card fits
- Space visualization
- Deep field exploration
- Cosmic dashboards
- Astronomy interfaces
- Immersive storytelling
Interaction states & animations
- Deep parallax
- Particle drift
- Star twinkle
- Pull-to-foreground
- Frame rivet glow
Topics
- #space
- #window
- #deep field
- #cosmos
- #stars
- #parallax
- #3d
- #particles
- #frame
Accessibility notes
The deep parallax effect may cause motion sensitivity. Small particle animations may be distracting. Provide prefers-reduced-motion fallback that removes parallax movement.
Browser support
- Chrome 90+
- Firefox 105+
- Safari 15+
- Edge 90+