Skip to content

Dream Book Card

A magical storybook card with ancient leather cover, gold edges, cloth bookmark, floating magical dust, and a pop-up world on opening.

Dream Book Card

by FreeCsStyles Dev's

CardsDream Book
🌐🎨⚛️

Embed this component

Paste this snippet into any site — the design renders in a sandboxed iframe served from /embed/dream-book-card.

<iframe src="/embed/dream-book-card" sandbox="allow-scripts" loading="lazy" title="Dream Book Card" style="border:0;width:100%;height:480px;overflow:hidden"></iframe>

Implementation code

Copy the HTML and CSS for Dream Book 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="book-card" onclick="this.classList.toggle('opened')">
  <div class="book-dust"></div>
  <div class="book-spine"></div>
  <div class="book-cover">
    <div class="book-emboss">
      <div class="book-title">The Enchanted Realm</div>
      <div class="book-author">E. L. Storyteller</div>
      <div class="book-icon">📖</div>
    </div>
  </div>
  <div class="book-world">
    <div class="book-story-text">Once upon a time...</div>
    <div class="book-story-icons">🌳 🏰 🐉 🧙</div>
  </div>
  <div class="book-content">
    <div class="book-header">
      <div><div class="book-name">The Enchanted Realm</div><div class="book-author-sm">E. L. Storyteller</div></div>
      <div class="book-status">CLOSED</div>
    </div>
    <div class="book-divider"></div>
    <div class="book-grid">
      <div class="book-stat"><div class="book-stat-val">Fantasy</div><div class="book-stat-lbl">Genre</div></div>
      <div class="book-stat"><div class="book-stat-val">324</div><div class="book-stat-lbl">Pages</div></div>
    </div>
    <div class="bookmark"></div>
    <div class="book-hint">[▼ open book]</div>
  </div>
</div>
CSS
.book-card {
  position: relative;
  width: 220px;
  min-height: 290px;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(160deg, #1a0e08, #120a06);
  border: 1.5px solid rgba(212,160,64,0.12);
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  cursor: pointer;
  transition: all 0.4s ease;
}

.book-card:hover {
  box-shadow: 0 25px 50px rgba(0,0,0,0.5), 0 0 20px rgba(212,160,64,0.06);
}

.book-dust {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.book-spine {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 12px;
  z-index: 10;
  background: #8a2a2a;
  border-radius: 4px 0 0 4px;
}

.book-cover {
  position: absolute;
  top: 5%;
  bottom: 5%;
  left: 6%;
  right: 3%;
  z-index: 5;
  border-radius: 8px;
  pointer-events: none;
  background: linear-gradient(160deg, #5a1a1a, #3a0e0e);
  border: 1.5px solid rgba(212,160,64,0.12);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-origin: left center;
}

.book-card.opened .book-cover {
  transform: rotateY(-60deg) scaleX(0.5);
  opacity: 0;
}

.book-emboss {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.book-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #d4a040;
}

.book-author {
  font-size: 7px;
  margin-top: 8px;
  color: #e8c080;
}

.book-icon {
  margin-top: 12px;
  font-size: 20px;
}

.book-world {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: none;
  align-items: center;
  justify-content: center;
}

.book-card.opened .book-world {
  display: flex;
  animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.book-story-text {
  font-size: 10px;
  font-weight: 700;
  margin-top: 8px;
  color: #d4a040;
}

.book-story-icons {
  display: flex;
  gap: 4px;
  margin-top: 8px;
  font-size: 14px;
}

.book-content {
  position: relative;
  z-index: 0;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-left: 14px;
}

.book-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.book-name {
  font-size: 14px;
  font-weight: 700;
  color: rgba(255,255,255,0.9);
}

.book-author-sm {
  font-size: 9px;
  color: rgba(212,160,64,0.5);
}

.book-status {
  padding: 2px 8px;
  border-radius: 2px;
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #d4a040;
  background: rgba(212,160,64,0.1);
  border: 1px solid rgba(212,160,64,0.12);
}

.book-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(212,160,64,0.08), transparent);
}

.book-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.book-stat {
  text-align: center;
  padding: 8px 4px;
  border-radius: 8px;
  background: rgba(212,160,64,0.02);
  border: 1px solid rgba(212,160,64,0.06);
}

.book-stat-val {
  font-size: 11px;
  font-weight: 600;
  color: #d4a040;
}

.book-stat-lbl {
  font-size: 7px;
  margin-top: 2px;
  color: rgba(255,255,255,0.2);
}

.bookmark {
  position: absolute;
  right: 12px;
  top: 10%;
  width: 4px;
  height: 96px;
  z-index: 20;
  pointer-events: none;
  background: #8a2a2a;
}

.bookmark::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: #d4a040;
}

.book-hint {
  text-align: center;
  font-size: 7px;
  font-family: monospace;
  color: rgba(212,160,64,0.2);
}

.book-card:hover .book-hint {
  transform: translateY(-1px);
}

@media (prefers-reduced-motion: reduce) {
  .book-card { transition: none; }
  .book-cover { transition: none; }
  .book-world { animation: none; }
  .book-hint { transition: none; }
}
Tailwind CSS
<div class="group relative w-[220px] min-h-[290px] rounded-xl overflow-hidden border border-amber-500/20 shadow-lg group-hover:shadow-[0_25px_50px_rgba(0,0,0,0.5),0_0_20px_rgba(212,160,64,0.06)] bg-gradient-to-br from-[#1a0e08] to-[#120a06] cursor-pointer">
  <div class="absolute left-0 top-0 bottom-0 w-3 z-10 bg-red-800 rounded-l-[4px]"></div>
  <div class="absolute inset-y-[5%] left-[6%] right-[3%] rounded-lg z-[5] pointer-events-none bg-gradient-to-br from-red-900 to-red-950 border border-amber-500/20 transition-all duration-500 origin-left group-hover:rotate-y-[-60deg] group-hover:scale-x-50 group-hover:opacity-0">
    <div class="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 text-center">
      <p class="text-[11px] font-bold tracking-widest text-amber-500">The Enchanted Realm</p>
      <p class="text-[7px] mt-2 text-amber-300">E. L. Storyteller</p>
      <div class="mt-3 text-xl group-hover:scale-110 transition-transform">📖</div>
    </div>
  </div>
  <div class="relative z-0 p-5 space-y-2 ml-[14px]">
    <div class="flex items-center justify-between">
      <div><p class="text-sm font-bold text-white/90">The Enchanted Realm</p><p class="text-[9px] text-amber-500/50">E. L. Storyteller</p></div>
      <div class="px-2 py-0.5 rounded-sm text-[7px] font-bold tracking-widest text-amber-500 bg-amber-500/10 border border-amber-500/20">CLOSED</div>
    </div>
    <div class="h-px bg-gradient-to-r from-transparent via-amber-500/20 to-transparent"></div>
    <div class="grid grid-cols-2 gap-2">
      <div class="text-center py-2 rounded-lg bg-amber-500/10 border border-amber-500/20"><p class="text-[11px] font-semibold text-amber-500">Fantasy</p><p class="text-[7px] mt-0.5 text-white/20">Genre</p></div>
      <div class="text-center py-2 rounded-lg bg-amber-500/10 border border-amber-500/20"><p class="text-[11px] font-semibold text-amber-500">324</p><p class="text-[7px] mt-0.5 text-white/20">Pages</p></div>
    </div>
    <div class="absolute right-3 top-[10%] w-1 h-24 z-20 pointer-events-none bg-red-800 group-hover:translate-y-1 transition-transform">
      <div class="absolute bottom-0 left-1/2 -translate-x-1/2 w-2 h-2 rounded-sm bg-amber-500"></div>
    </div>
    <div class="text-center"><span class="text-[7px] font-mono text-amber-500/30">[▼ open book]</span></div>
  </div>
</div>
React
import React, { useState, useRef } from 'react';
import { motion, useMotionValue, useSpring } from 'framer-motion';

export function DreamBookCard() {
  const [isHovered, setIsHovered] = useState(false);
  const [isOpen, setIsOpen] = useState(false);
  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 handleMouseMove = (e) => {
    if (!ref.current) return;
    const rect = ref.current.getBoundingClientRect();
    const cx = rect.left + rect.width / 2;
    const cy = rect.top + rect.height / 2;
    x.set(-((e.clientX - cx) / (rect.width / 2)) * 6);
    y.set(((e.clientY - cy) / (rect.height / 2)) * 6);
  };
  return (
    <div onMouseEnter={() => setIsHovered(true)} onMouseLeave={() => { setIsHovered(false); x.set(0); y.set(0); }}>
      <motion.div ref={ref} onMouseMove={handleMouseMove} onClick={() => setIsOpen(!isOpen)} style={{ rotateX, rotateY, transformStyle: 'preserve-3d', cursor: 'pointer' }}>
        <motion.div className="relative overflow-hidden rounded-xl" style={{ width: 220, minHeight: 290, background: 'linear-gradient(160deg, #1a0e08, #120a06)', border: '1.5px solid rgba(212,160,64,0.12)' }}
          animate={{ boxShadow: isHovered ? '0 25px 50px rgba(0,0,0,0.5), 0 0 20px rgba(212,160,64,0.06)' : '0 10px 30px rgba(0,0,0,0.3)' }} transition={{ type: 'spring', stiffness: 280, damping: 20 }}>
          {isHovered && [...Array(12)].map((_, i) => (
            <motion.div key={i} className="absolute rounded-full pointer-events-none" style={{ width: 1.5 + Math.random() * 2, height: 1.5 + Math.random() * 2, background: '#d4a040' }}
              initial={{ x: `${10 + Math.random() * 80}%`, y: `${10 + Math.random() * 80}%`, opacity: 0.6 }}
              animate={{ y: [0, -20 - i * 3], opacity: [0.6, 0], scale: [1, 0] }} transition={{ duration: 1.5 + Math.random(), repeat: Infinity, delay: i * 0.15, ease: 'easeOut' }} />
          ))}
          <div className="absolute left-0 top-0 bottom-0 w-3 z-10" style={{ background: '#8a2a2a', borderRadius: '4px 0 0 4px' }} />
          <motion.div className="absolute inset-y-[5%] left-[6%] right-[3%] rounded-lg z-[5] pointer-events-none" style={{ background: 'linear-gradient(160deg, #5a1a1a, #3a0e0e)', border: '1.5px solid rgba(212,160,64,0.12)', transformOrigin: 'left center' }}
            animate={isOpen ? { rotateY: -60, scaleX: 0.5, opacity: 0 } : { rotateY: 0, scaleX: 1, opacity: 1 }} transition={{ type: 'spring', stiffness: 150, damping: 15 }}>
            <div className="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 text-center">
              <p className="text-[11px] font-bold tracking-widest" style={{ color: '#d4a040' }}>The Enchanted Realm</p>
              <p className="text-[7px] mt-2" style={{ color: '#e8c080' }}>E. L. Storyteller</p>
              <motion.div className="mt-3 text-xl" animate={isHovered ? { scale: [1, 1.1, 1] } : {}} transition={{ duration: 2, repeat: isHovered ? Infinity : 0 }}>📖</motion.div>
            </div>
          </motion.div>
          {isOpen && (
            <motion.div className="absolute inset-0 z-10 flex items-center justify-center pointer-events-none" initial={{ opacity: 0 }} animate={{ opacity: 1 }} transition={{ duration: 0.5 }}>
              <div className="text-center p-4">
                <motion.p className="text-lg" initial={{ scale: 0 }} animate={{ scale: 1 }} transition={{ type: 'spring', delay: 0.2 }}>🏰</motion.p>
                <motion.p className="text-[10px] font-bold mt-2" style={{ color: '#d4a040' }} initial={{ opacity: 0, y: 10 }} animate={{ opacity: 1, y: 0 }} transition={{ delay: 0.4 }}>Once upon a time...</motion.p>
                <motion.div className="flex justify-center gap-1 mt-2" initial={{ opacity: 0 }} animate={{ opacity: 1 }} transition={{ delay: 0.6 }}>
                  {['🌳', '🏰', '🐉', '🧙'].map((e, i) => (<motion.span key={i} className="text-xs" animate={{ y: [0, -3, 0] }} transition={{ duration: 1.5, repeat: Infinity, delay: i * 0.3 }}>{e}</motion.span>))}
                </motion.div>
              </div>
            </motion.div>
          )}
          <div className="relative z-0 p-5 space-y-2" style={{ marginLeft: 14 }}>
            <div className="flex items-center justify-between">
              <div><p className="text-sm font-bold text-white/90">{isOpen ? '✦ The Story Unfolds ✦' : 'The Enchanted Realm'}</p><p className="text-[9px]" style={{ color: 'rgba(212,160,64,0.5)' }}>E. L. Storyteller</p></div>
              <motion.div className="px-2 py-0.5 rounded-sm text-[7px] font-bold tracking-widest" style={{ background: 'rgba(212,160,64,0.1)', border: '1px solid rgba(212,160,64,0.12)', color: '#d4a040' }}
                animate={isHovered ? { opacity: [0.6, 1, 0.6] } : {}} transition={{ duration: 1.5, repeat: isHovered ? Infinity : 0 }}>{isOpen ? 'OPEN' : 'CLOSED'}</motion.div>
            </div>
            <div className="h-px" style={{ background: 'linear-gradient(90deg, transparent, rgba(212,160,64,0.08), transparent)' }} />
            {isOpen ? (
              <div className="space-y-1.5 pt-1">
                <p className="text-[8px] leading-relaxed" style={{ color: '#e8c080' }}>"In a land of eternal twilight, a young hero discovers a hidden realm of ancient magic..."</p>
              </div>
            ) : (
              <div className="grid grid-cols-2 gap-2">
                <div className="text-center py-2 rounded-lg" style={{ background: 'rgba(212,160,64,0.02)', border: '1px solid rgba(212,160,64,0.06)' }}>
                  <p className="text-[11px] font-semibold" style={{ color: '#d4a040' }}>Fantasy</p><p className="text-[7px] mt-0.5 text-white/20">Genre</p>
                </div>
                <div className="text-center py-2 rounded-lg" style={{ background: 'rgba(212,160,64,0.02)', border: '1px solid rgba(212,160,64,0.06)' }}>
                  <p className="text-[11px] font-semibold" style={{ color: '#d4a040' }}>324</p><p className="text-[7px] mt-0.5 text-white/20">Pages</p>
                </div>
              </div>
            )}
            <motion.div className="absolute right-3 top-[10%] w-1 h-24 z-20 pointer-events-none" style={{ background: '#8a2a2a' }} animate={isHovered ? { y: [0, 3, 0] } : {}} transition={{ duration: 2, repeat: isHovered ? Infinity : 0, ease: 'easeInOut' }}>
              <div className="absolute bottom-0 left-1/2 -translate-x-1/2 w-2 h-2 rounded-sm" style={{ background: '#d4a040' }} />
            </motion.div>
            <motion.div className="text-center pt-1" animate={isHovered ? { y: [0, -1, 0] } : {}} transition={{ duration: 1.5, repeat: isHovered ? Infinity : 0 }}>
              <span className="text-[7px] font-mono" style={{ color: 'rgba(212,160,64,0.2)' }}>{isOpen ? '[▼ close book]' : '[▼ open book]'}</span>
            </motion.div>
          </div>
        </motion.div>
      </motion.div>
    </div>
  );
}

Interaction states & animations

  • Hover