Exploding like buttonOne-line
GPT-5 Nano
by OpenAIReasoningClean
Running live in a sandboxed frame. Click inside it before using the keyboard.
How it went
- Total time
- 2 min 48 s
- Cost
- $0.0074
- Output tokens
- 18,477
- Spent thinking
- 16,064 tokens
- Speed
- 114.1 tok/s
- Console errors
- 0
- First token after
- 6.2 s
- First visible text after
- 2 min 26 s
- Prompt tokens
- 356
- Code size
- 7.4 KB
- Finish reason
- stop
- Served by
- OpenAI
- Model id
openai/gpt-5-nano- Reasoning sent
{"effort":"high"}- Max output
- 128,000 tokens
- Generated
- Nov 12, 2026
What it was asked
The prompt
“a "like" button in pure CSS, no JavaScript, that does a crazy animation when you click it”
System prompt, sent with every prompt
You are generating a self-contained web demo. It will be rendered automatically in a sandboxed iframe and compared side by side with the output of other AI models given the exact same task. Output rules: - Reply with exactly ONE fenced code block containing the complete file: ```html (or ```svg when the task asks for an SVG). No text before or after the code block. - Everything must be inline: CSS in <style>, JavaScript in <script>. No external files, images, fonts or network requests, except the CDN URLs explicitly allowed by the task. - Do not use localStorage, sessionStorage, cookies, IndexedDB, alert(), confirm(), prompt() or window.open(): they are blocked in the sandbox and will throw. - The page must look right in a 1280×800 viewport and adapt gracefully down to 375px wide. No horizontal scrollbar. - Something meaningful must be visible on first paint: a screenshot is taken automatically about 3 seconds after load, without any interaction. - Everything that makes the demo interesting must be visible within the first seconds: nothing hidden behind a high score, a later level or a long play session. - Games must start in a self-playing demo mode (a simple AI plays) behind a "Click or press a key to start" message, so the game can be judged in action without playing. - The iframe only receives keyboard events after the user clicks it: if the demo uses the keyboard, display a clear "Click or press a key to start" message. - The code must run with zero errors in the console of the latest Chrome.
Code run-1.html · 219 lines
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Pure CSS Like Button with Crazy Animation</title>
<style>
:root {
--pink: #ff4d8e;
--pink-dark: #e10066;
--bg1: #0b0f1f;
--bg2: #141a36;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
margin: 0;
background: radial-gradient(circle at 20% 0%, rgba(255,255,255,.08), transparent 20%),
radial-gradient(circle at 80% 0%, rgba(255,200,230,.15), transparent 25%),
linear-gradient(135deg, #0b0f1f 0%, #141a36 60%, #0b0f1f 100%);
font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial;
color: #fff;
min-height: 100vh;
display: grid;
place-items: center;
overflow-x: hidden;
}
.card {
width: min(860px, 92vw);
background: rgba(255,255,255,.08);
border: 1px solid rgba(255,255,255,.25);
border-radius: 28px;
padding: clamp(20px, 4vw, 32px);
box-shadow: 0 18px 60px rgba(0,0,0,.4);
text-align: center;
}
.headline {
margin: 0 0 6px;
font-weight: 800;
font-size: clamp(20px, 4vw, 28px);
letter-spacing: .4px;
}
.subhead {
margin: 0 0 22px;
color: rgba(255,255,255,.92);
font-size: clamp(12px, 2.5vw, 14px);
}
.like-area {
display: grid;
place-items: center;
padding: 8px;
}
/* Hide the actual checkbox but keep it accessible for keyboard navigation */
#like {
position: absolute;
left: -9999px;
}
.like-btn {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 14px;
padding: 14px 28px;
border-radius: 999px;
border: 1px solid rgba(255,255,255,.5);
background: linear-gradient(135deg, rgba(255,255,255,.18), rgba(255,255,255,.08));
color: #fff;
font-weight: 700;
cursor: pointer;
position: relative;
overflow: visible;
text-transform: none;
user-select: none;
}
.like-btn:hover {
transform: translateY(-1px);
}
.heart {
font-size: clamp(48px, 9vw, 64px);
line-height: 1;
display: inline-block;
color: #d3d3d3;
transition: transform .4s ease, color .25s ease, text-shadow .25s ease;
text-shadow: 0 2px 6px rgba(0,0,0,.25);
}
/* Colorful glow and pop when liked (checked) */
#like:checked + .like-btn .heart {
color: var(--pink);
transform: scale(1.25) rotate(-2deg);
text-shadow: 0 0 14px rgba(255,77,142,.9), 0 0 28px rgba(255,0,150,.6);
}
.like-label {
font-family: inherit;
font-weight: 800;
font-size: clamp(20px, 3vw, 24px);
color: #fff;
letter-spacing: .4px;
}
/* Burst particles (hidden by default) */
.burst {
position: absolute;
left: 50%;
top: 50%;
width: 8px;
height: 8px;
border-radius: 50%;
background: #fff;
opacity: 0;
transform: translate(-50%, -50%);
pointer-events: none;
}
.burst.b1 { background: #ffd1dc; }
.burst.b2 { background: #ffe18a; }
.burst.b3 { background: #e5ffb3; }
.burst.b4 { background: #c6e0ff; }
.burst.b5 { background: #ffc2f0; }
.burst.b6 { background: #baffd4; }
.burst.b7 { background: #fbd0ff; }
.burst.b8 { background: #fff0a8; }
/* Trigger animations when the button is activated (checked) */
#like:checked + .like-btn .b1 { animation: burst1 700ms ease-out forwards; }
#like:checked + .like-btn .b2 { animation: burst2 800ms ease-out forwards; }
#like:checked + .like-btn .b3 { animation: burst3 850ms ease-out forwards; }
#like:checked + .like-btn .b4 { animation: burst4 900ms ease-out forwards; }
#like:checked + .like-btn .b5 { animation: burst5 900ms ease-out forwards; }
#like:checked + .like-btn .b6 { animation: burst6 950ms ease-out forwards; }
#like:checked + .like-btn .b7 { animation: burst7 900ms ease-out forwards; }
#like:checked + .like-btn .b8 { animation: burst8 900ms ease-out forwards; }
@keyframes burst1 {
0% { transform: translate(-50%, -50%) translate(0,0) scale(0.6); opacity: 0.95; }
100% { transform: translate(-50%, -50%) translate(-60px, -60px) scale(1.25); opacity: 0; }
}
@keyframes burst2 {
0% { transform: translate(-50%, -50%) translate(0,0) scale(0.6); opacity: 0.95; }
100% { transform: translate(-50%, -50%) translate(0px, -78px) scale(1.25); opacity: 0; }
}
@keyframes burst3 {
0% { transform: translate(-50%, -50%) translate(0,0) scale(0.6); opacity: 0.95; }
100% { transform: translate(-50%, -50%) translate(60px, -60px) scale(1.25); opacity: 0; }
}
@keyframes burst4 {
0% { transform: translate(-50%, -50%) translate(0,0) scale(0.6); opacity: 0.95; }
100% { transform: translate(-50%, -50%) translate(78px, 0px) scale(1.25); opacity: 0; }
}
@keyframes burst5 {
0% { transform: translate(-50%, -50%) translate(0,0) scale(0.6); opacity: 0.95; }
100% { transform: translate(-50%, -50%) translate(40px, 70px) scale(1.25); opacity: 0; }
}
@keyframes burst6 {
0% { transform: translate(-50%, -50%) translate(0,0) scale(0.6); opacity: 0.95; }
100% { transform: translate(-50%, -50%) translate(-70px, 20px) scale(1.25); opacity: 0; }
}
@keyframes burst7 {
0% { transform: translate(-50%, -50%) translate(0,0) scale(0.6); opacity: 0.95; }
100% { transform: translate(-50%, -50%) translate(-42px, 70px) scale(1.25); opacity: 0; }
}
@keyframes burst8 {
0% { transform: translate(-50%, -50%) translate(0,0) scale(0.6); opacity: 0.95; }
100% { transform: translate(-50%, -50%) translate(-78px, -42px) scale(1.25); opacity: 0; }
}
/* Better accessibility for motion preferences */
@media (prefers-reduced-motion: reduce) {
.burst { display: none; }
#like:checked + .like-btn .heart { transform: none; color: var(--pink); }
}
/* Small screens: scale down heart a bit to avoid overflow */
@media (max-width: 420px) {
.card { padding: 20px; }
.heart { font-size: 52px; }
}
/* Prevent horizontal scrollbar from any overflow on huge bursts */
@media (min-width: 1200px) {
.card { max-width: 900px; }
}
</style>
</head>
<body>
<main class="card" aria-label="Pure CSS like button demo">
<div class="headline">Pure CSS Like Button with Crazy Animation</div>
<div class="subhead">No JavaScript. Click the heart to trigger a CSS-only burst of confetti-like particles.</div>
<div class="like-area" aria-label="Like demo area">
<input id="like" type="checkbox" />
<label class="like-btn" for="like" aria-label="Like button, click to toggle">
<span class="heart" aria-hidden="true">❤</span>
<span class="like-label">Like</span>
<span class="burst b1" aria-hidden="true"></span>
<span class="burst b2" aria-hidden="true"></span>
<span class="burst b3" aria-hidden="true"></span>
<span class="burst b4" aria-hidden="true"></span>
<span class="burst b5" aria-hidden="true"></span>
<span class="burst b6" aria-hidden="true"></span>
<span class="burst b7" aria-hidden="true"></span>
<span class="burst b8" aria-hidden="true"></span>
</label>
</div>
</main>
</body>
</html>Reasoning trace (16,064 tokens)
**Implementing a CSS "like" button** I need to create a "like" button in pure CSS without any JavaScript, which includes a crazy animation on click. The user wants it to start in self-playing mode. I recall that self-contained web demos need to be renderable in an iframe. I can use the checkbox hack with an input of type "checkbox" and leverage the :checked pseudo-class to activate animations. For the crazy animation, I could consider particle effects or a radial gradient explosion using CSS.**Designing the CSS "like" button** I’ll create a button by using a label linked to a hidden checkbox. When the checkbox is checked, I can trigger CSS animations like a heart morph or confetti shapes—no JavaScript needed. The guidelines mention a self-contained web demo that starts in a self-playing mode, even though this isn't a game. I need to ensure that the demo looks good initially and shows something meaningful within the first three seconds.**Creating the CSS "Like" button** I'm planning a demo featuring a large "Like" button with animation powered solely by CSS. I could use confetti-like shapes triggered by CSS keyframes when the button is checked. Initially, it will display "Click to like" alongside a heart icon that animates upon clicking. Even though the guidelines emphasize no JavaScript, I need to include a clear message for accessibility, reminding users to "Click or press a key to start" for keyboard interactions.**Designing the CSS "Like" button** I'm going to create a "Like" button using a CSS label that toggles a hidden checkbox when clicked. Keyboard interactions aren’t needed here, so I won’t incorporate any keyboard hooking. The final output will be a single code block with complete HTML and inline CSS, but no JavaScript. I'll make a full viewport container with a gradient background and style the button as a heart, utilizing the ::before and ::after pseudo-elements for a nice visual effect.**Building the heart shape with CSS** I want to create a heart shape for the "Like" button using pure CSS, so I’ll use pseudo-elements to form the lobes and a triangle for the bottom point. I can easily create this heart by overlapping two circles, rotating the container to achieve the shape. Even though inline SVG isn't strictly for CSS, I'm opting to stick to CSS only for clarity. When the button is clicked, I can scale the heart and trigger small burst animations to create confetti effects. I’ll manage these bursts with CSS, ensuring they'll animate outward when the checkbox is checked, then reset on uncheck.**Structuring the "Like" button** I'm planning to implement the "Like" button using an input checkbox that is hidden and a label that serves as the clickable area. The label will contain the heart shape and multiple burst spans for the animation. To ensure the animations trigger correctly when the checkbox is checked, I'll use CSS sibling selectors. The label will refer to the checkbox's ID, allowing it to toggle the input. I also need to make sure the heart changes color to pink when the button is liked, and I'll structure everything to work purely with CSS.**Creating the heart shape and burst effects** I'm diving into building the heart as a CSS shape using pseudo-elements within the label. I want the heart to rotate correctly while maintaining its proportions, and consider using a heart emoji or text as a simpler alternative. I plan to animate burst shapes that appear when the checkbox is checked. For the burst effects, I’ll use absolute positioning and define individual animations for each burst to explode outward at various angles. It should create a fun and engaging effect when the "Like" button is activated!**Finalizing CSS for heart and burst animation** I'm implementing CSS transforms for the burst animations. Each burst will have keyframes to transform and rotate as they move outward. With 12 bursts planned, I'll position them in various directions. The heart will also change color and scale when checked, creating an engaging effect. I want the design to be responsive and ensure visibility from the first paint, with a friendly message like "Click to Like." Accessibility remains essential, so I'll be mindful of using appropriate ARIA attributes.**Implementing heart animation with bursts** I’m working on the CSS for the heart and its burst effects. When the heart is clicked, it will change color and scale up, while 12 bursts radiate outward in different directions. Each burst will transform from the center and use absolute positioning combined with a translate function for precise movement. I'll also ensure the heart has a glowing effect and the overall design remains accessible, ensuring visible elements appear from the first paint and provide clear user instructions.**Creating a CSS Like Button** I'm trying to create a pure CSS like button with animations. The HTML structure includes a checkbox for accessibility, and the styling defines an engaging user interface with gradients and animated bursts when the button is clicked. Each burst has a specific animation and color to make it visually appealing. The code also outlines how to transition the heart's color and size on checked, ensuring a fun and interactive experience while remaining accessible.**Finalizing CSS for Button** I'm adjusting the CSS to center the label's container and manage animations efficiently. It's essential to disable animations for users who prefer reduced motion. The like button's bursts will only appear when clicked, and their initial state will be hidden. I'm also ensuring responsiveness and preventing horizontal scrolling. For accessibility, I'll use screen reader-friendly text. I'll finalize the CSS to create a seamless and visually appealing experience while managing how bursts display post-click.**Designing CSS Animations** I’m working on the CSS to ensure the animation for the like button triggers correctly each time the input toggles. The animation restarts when the element's style changes. I want to keep the design adaptive for smaller screens and ensure no horizontal scrolling occurs. I need to solidify the CSS structure and attributes for the bursts, like colors and opacity. I’ll finalize the HTML layout while maintaining accessibility standards. Once everything’s ready, I’ll ensure a seamless animation experience without relying on JavaScript. Time for precise execution!**Finalizing the Code Design** I need to make sure the label's pseudo-element uses the content property correctly. I’ll implement a ring that appears when the button is checked, and I’ll take note of the necessary animations: a heart “pop” and burst shapes around it. There could be potential issues with the opacity and z-index of the elements, so I’ll adjust them accordingly. Now it's time to craft the final code in a single HTML block, ensuring everything compiles well within the environment without any extraneous text. Let’s get to coding!**Crafting the HTML Structure** I'm starting the HTML for a Pure CSS Like Button that features a crazy animation. It’s important to set the doctype and establish the language in the beginning. The head contains metadata like charset, viewport settings, and the title. I've defined CSS variables for color customization to create a visually appealing background with gradients and textures. The body will feature a card layout to hold the button and include important accessibility features. Creating the structure for the button and its animations is next on my to-do list. Let's keep going!**Finalizing the Like Button Code** I’m wrapping up the code for my Pure CSS Like Button with burst animations. I need to ensure everything is structured correctly within one code block, following guidelines closely. The bursts have to animate correctly since they start with `opacity: 0` and move them from the center upon activation. I also want to keep accessibility in mind, making sure users can click or toggle via keyboard. Finally, I'll check the layout for any stray elements or tags and confirm all details are in place before presenting the final version.