Best For
card stack / stacked cards / card deck
卡片堆叠布局
3D layout with overlapping cards, creating depth through Z-axis stacking and offsets. Ideal for carousels, step-by-step displays, and card deck selection.
Best For
card stack / stacked cards / card deck
Primary Move
Use transform and z-index to create stacking effects
Watch Out
Do not stack too many cards causing clutter
AI Implementation
Use the Hard Prompt by default to generate UI. Use the Design Spec to understand, modify, and review the style. Use the Creative Brief for early exploration.
Use this by default: copy it, append the concrete requirement, and let AI generate consistent production UI.
When to use
How to use
STYLEKIT_STYLE_REFERENCE
style_name: Card Stack
style_slug: card-stack
style_source: /styles/card-stack
# Hard Prompt
## When To Use
Use this when you want AI to generate code with strict style consistency. It is the safest default for production UI.
## How To Use
- Copy the full prompt into ChatGPT, Claude, Cursor, or another coding assistant.
- Append the concrete product/page requirement after the prompt.
- After generation, check the forbidden rules and interaction states before accepting the output.
Strictly follow the style rules below and maintain consistency. No style drift allowed.
## Requirements
- Prioritize style consistency first, then creative extension.
- When conflicts arise, treat prohibitions as the highest priority.
- Self-check before output: verify colors, typography, spacing, and interactions still match this style.
## Style Rules
You are a frontend expert specializing in Card Stack layout. All generated code must strictly follow these constraints:
## Absolute Prohibitions
- Do NOT stack too many visible cards (max 3-5)
- Do NOT overlap cards completely (need visual distinction)
- Do NOT forget interaction feedback
- Do NOT use overly complex animations
- Do NOT use complex gestures on mobile
- Do NOT leave back cards static during hover (kills depth illusion)
## Must Follow
- Use transform for positioning: scale, translateY, rotate
- Use z-index for layering: z-30, z-20, z-10
- Progressive opacity: 100%, 80%, 60%
- Smooth transitions: transition-all duration-[400ms] ease-out
- Clear hover/active states
- Limit visible cards: 3-5 maximum
## Animation & Interaction Rules
- Deck Shuffling: On group-hover, back cards fan out sideways with different rotate + translate-x values, like shuffling a deck of cards.
- 3D Peeling: Top card on hover should significantly lift (group-hover:-translate-y-6 group-hover:scale-105 group-hover:shadow-2xl), simulating physical card being raised.
- Smooth Return: Use ease-out so cards snap back naturally from fast to slow.
- Stack Peek: Slightly change back card opacity on hover to hint their presence.
## Stack Structure
Container:
- relative position with group class for sibling interactions
- flex center alignment
- Fixed height for consistent layout
Cards (front to back):
- Card 1 (front): z-30, scale-100, opacity-100
- Card 2 (mid): z-20, scale-95, translateY-4, rotate-2, opacity-80
- Card 3 (back): z-10, scale-90, translateY-8, rotate(-3), opacity-60
On group-hover:
- Card 1: -translate-y-6, scale-105, shadow-2xl
- Card 2: rotate-6, translate-x-(-5), translate-y-8
- Card 3: -rotate-6, translate-x-5, translate-y-14
## Self-Check
After generating code, verify:
1. Cards are visually layered with different scale + opacity
2. group-hover fans back cards out to the sides
3. Front card lifts dramatically on hover
4. Max 3-5 visible cards
5. Mobile-friendly touch targets
## Absolute Bans (Match and Refuse)
If any of the following patterns appear, it is a style violation — rewrite without exception.
- stack too many cards causing clutter
- completely overlap cards hiding layer distinction
- ignore interaction feedback
- use overly complex animations affecting performance
- use overly complex gestures on mobile
- leave back cards static on hover (lacks depth perception)
## Self-Check (Verify Before Shipping)
If any item fails, the style has drifted — fix before shipping.
- [ ] No purple-to-blue gradients
- [ ] No overused fonts (Inter, Roboto, Geist, Fraunces, Plus Jakarta Sans)
- [ ] No nested cards (cards inside cards)
- [ ] No gray text on colored backgrounds
- [ ] Body text contrast meets WCAG AA (>= 4.5:1)
- [ ] No bounce or elastic easing curves
- [ ] Animations have a prefers-reduced-motion fallback
- [ ] Body text line length capped at 65-75 characters
- [ ] No side-stripe accent borders (border-left/right > 1px)
- [ ] No gradient text (background-clip: text)
- [ ] No glassmorphism used as the default surface treatment
- [ ] No tiny uppercase tracked eyebrow labels above every section heading
- [ ] do not stack too many cards causing clutter
- [ ] do not completely overlap cards hiding layer distinction
- [ ] do not ignore interaction feedback
- [ ] do not use overly complex animations affecting performance
- [ ] do not use overly complex gestures on mobileComponent Templates
用于切换卡片的导航按钮,hover 时上浮
Frontend Readiness
This layer tracks whether the style is ready for real websites: theme modes, state feedback, keyboard access, and performance constraints.
Overall
51%
Fallback
Dark Mode
0%
MissingUI States
79%
PartialMotion
70%
PartialA11y
70%
PartialPerformance
35%
FallbackButton
Default / Hover / Focus Visible / Active / Disabled
Input
Default / Hover / Focus Visible / Disabled / Error
Card
Default / Hover / Focus Visible / Loading / Skeleton
Form
Default / Focus Visible / Disabled / Loading / Error
FAQ
/* Card Stack Global Styles */
/* Stack container */
.card-stack {
position: relative;
display: flex;
align-items: center;
justify-content: center;
perspective: 1000px;
}
/* Base card in stack */
.card-stack-item {
position: absolute;
transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
/* Stack positions */
.card-stack-item:nth-child(1) {
z-index: 30;
transform: translateY(0) scale(1);
opacity: 1;
}
.card-stack-item:nth-child(2) {
z-index: 20;
transform: translateY(16px) scale(0.95) rotate(2deg);
opacity: 0.8;
}
.card-stack-item:nth-child(3) {
z-index: 10;
transform: translateY(32px) scale(0.9) rotate(-3deg);
opacity: 0.6;
}
.card-stack-item:nth-child(n+4) {
z-index: 0;
transform: translateY(48px) scale(0.85);
opacity: 0;
pointer-events: none;
}
/* Fan out on hover — deck shuffle effect */
.card-stack:hover .card-stack-item:nth-child(1) {
transform: translateY(-24px) scale(1.05);
box-shadow: 0 30px 60px rgba(0, 0, 0, 0.2);
}
.card-stack:hover .card-stack-item:nth-child(2) {
transform: translateY(32px) scale(0.95) rotate(6deg) translateX(-20px);
opacity: 0.9;
}
.card-stack:hover .card-stack-item:nth-child(3) {
transform: translateY(48px) scale(0.9) rotate(-6deg) translateX(20px);
opacity: 0.8;
}
/* Tinder-style swipe */
.card-stack-swipe .card-stack-item.swiping-left {
transform: translateX(-100%) rotate(-10deg);
opacity: 0;
}
.card-stack-swipe .card-stack-item.swiping-right {
transform: translateX(100%) rotate(10deg);
opacity: 0;
}
/* Card Stack Design Tokens */
:root {
--card-stack-primary: #1a1a2e;
--card-stack-secondary: #f0f0f5;
--card-stack-accent: #6c5ce7;
--card-stack-glow: rgba(26, 26, 46, 0.3);
}
@keyframes card-stack-fade-in {
from { opacity: 0; transform: translateY(8px); }
to { opacity: 1; transform: translateY(0); }
}
@keyframes card-stack-pulse {
0%, 100% { opacity: 1; }
50% { opacity: 0.7; }
}
.card-stack-card {
position: relative;
overflow: hidden;
}
.card-stack-card::before {
content: "";
position: absolute;
inset: 0;
opacity: 0;
transition: opacity 0.3s ease;
background: linear-gradient(135deg, rgba(26, 26, 46, 0.05), transparent);
pointer-events: none;
}
.card-stack-card:hover::before {
opacity: 1;
}
.card-stack-gradient {
background: linear-gradient(135deg, #1a1a2e, #6c5ce7);
}
.card-stack-gradient-text {
background: linear-gradient(135deg, #1a1a2e, #6c5ce7);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
}
.card-stack-frosted {
backdrop-filter: blur(12px) saturate(180%);
-webkit-backdrop-filter: blur(12px) saturate(180%);
background: rgba(26, 26, 46, 0.08);
}
.card-stack-accent-corner {
clip-path: polygon(0 0, 100% 0, 100% calc(100% - 2rem), calc(100% - 2rem) 100%, 0 100%);
}
.card-stack-animate-in {
animation: card-stack-fade-in 0.5s ease-out both;
}Compatible Visual Styles
Card Stack is a layout pattern that can be paired with the following visual styles.
IDE Integration
Download configuration files for AI coding assistants to generate code in this style.
Style Pack
Get complete machine-readable style assets including design tokens, Tailwind presets, CSS variables, and shadcn/ui themes.
Metadata
Style metadata including version information
Design Tokens
Compatible with Figma / Style Dictionary / Tokens Studio
Tailwind Preset
Tailwind CSS theme preset, import directly in config
Global CSS
CSS variables and base styles
shadcn Theme
shadcn/ui theme configuration
CSS Variables
Pure CSS variables, works with any project
SKILL.md
Loadable skill pack for Cursor / Claude Code / VS Code
Card Stack is a layout approach that creates depth perception using the Z-axis, with multiple cards overlapping front to back to form visual layers.
WCAG 2.1 compliance analysis based on color contrast and typography readability.
Overall Score
Grade: B - Good
Contrast Ratios
| Context | Colors | Ratio | AA | AAA |
|---|---|---|---|---|
| Text on secondary background | /#18181b / #ffffff | 17.72:1 | ||
| Button primary | /#ffffff / #18181b | 17.72:1 | ||
| Text on accent 1 | /#18181b / #6c5ce7 | 3.65:1 | ||
| Text on accent 2 | /#18181b / #00cec9 | 9:1 | ||
| Text on accent 3 | /#18181b / #fd79a8 | 7.15:1 | ||
| Text on accent 4 | /#18181b / #ffeaa7 | 14.83:1 |
Readability
Score
85/100
Font Size
text-sm md:text-base
Font Weight
font-bold tracking-tight
Line Height
default
Scoring is based on WCAG 2.1 standards. AA requires 4.5:1 contrast for normal text, 3:1 for large text; AAA requires 7:1 for normal text, 4.5:1 for large text.
Design Recipes
These curated recipes combine this style with layouts and animations, optimized for specific use cases.