Loading video...

Video Failed to Load

Go Home

responsive stacked tabs w/ CSS grid 👨‍🍳 + works with keyboard navigation + drag gestures + container queries for orientation

71,182 views • 10 months ago •via X (Twitter)

0 Comments

No comments available

Comments from the original post will appear here

Related Videos

CSS Tip! 💪 You can create these tab controls with CSS :has() + radio buttons ✨ .tabs:has(input:nth-of-type(3)) { --count: 3; } .tabs:has(:checked:nth-of-type(3)) { --active: 2; } .tabs::after { translate: calc(var(--active, 0) * 100%) 0; width: calc(100% / var(--count)); } Two CSS :has() tricks here combined with a rendering trick 🤙 The tab control is a container using display: grid. You can use :has() to count the number of tabs in the container: .tabs:has(input:nth-of-type(3)) { --count: 3; } .tabs:has(input:nth-of-type(4)) { --count: 4; } Using the cascade, the last valid :has() gives you the number of tabs 🫶 Once you know the number of tabs, you know how to size the indicator: .tabs::after { content: ""; position: absolute; height: 100%; width: calc(100% / var(--count)); } It's a pseudoelement that uses --count to determine its size 📏 The next :has() trick is determining which tab is active or :checked as it's an input [type=radio] .tabs:has(:checked:nth-of-type(2)) { --active: 1; } .tabs:has(:checked:nth-of-type(3)) { --active: 2; } You can use a zero-indexed translation here. If the second input is :checked, set --active: 1, then translate the pseudoelement on the tabs to that position 👉 .tabs::after { translate: calc(var(--active, 0) * 100%) 0; } The last rendering trick is using mix-blend-mode 👀 The tabs have a black background-color, the pseudoelement is white, and the label text is white. When you use mix-blend-mode: difference on the pseudoelement it will give this effect that the text transitions from white to black sliding across 😎 .tabs::after { color: hsl(0 0% 100%); mix-blend-mode: difference; } You can totally mix up the colors here though and go with a different effect. The mechanics of how you can use CSS :has() is the main point here 🙏 As always, any questions, suggestions, etc. let me know CodePen.IO link below! 👇 (There's even a Tailwind CSS play for this one too 👀)

jhey ʕ•ᴥ•ʔ

437,533 views • 2 years ago

CSS Tip! 💫 You can create this responsive perspective warp animation with 3D CSS and container queries ✨ (Video reveals trick 👀) .warp { container-type: size; perspective: 100px; transform-style: preserve-3d; resize: both; overflow: hidden; } Couple of tricks in this one 🤓 The main idea is to create a tunnel (an open-ended cube). On each side of the tunnel, use linear-gradient to create the grid lines ✨ .side { background: linear-gradient(#​fff 0 1px, transparent 1px 5%) 50% 0 / 5% 5%, linear-gradient(90deg, #​fff 0 1px, transparent 1px 5%) 50% 50% / 5% 5%; } To position each side, you rotate on the x-axis by 90deg. Each side would become invisible at this point. So you give the scene perspective 😉 .warp__side--top { width: 100cqi; height: 100cqmax; transform-origin: 50% 0%; transform: rotateX(-90deg); } The cool part here is that you want to make each side the same height. But the container is responsive. So you can use a container query and make sure each side is 100cqmax tall 🫶 Then the "beams". Each side contains "beams". They have different colors, sizes, and positions, and move at different speeds ⚡️ We can control that through scoped custom properties. .beam { width: 5%; position: absolute; top: 0; left: calc(var(--x, 0) * 5%); aspect-ratio: 1 / 2; background: linear-gradient( hsl(var(--hue) 80% 60%), transparent ); translate: 0 100%; animation: warp calc(var(--speed, 0) * 1s) calc(var(--delay, 0) * -1s) infinite linear; } The magic here is though that a beam's animation is as basic as translating it from the top of the side to the bottom. And you can get that distance with a container query again 🔥 @​keyframes warp { 0% { translate: -50% 100cqmax; } 100% { translate: -50% -100%; } } And that is pretty much it! A cool warp animation effect using 3D CSS and container queries ⚡️ If you have any questions, let me know ᵔᴥᵔ CodePen.IO link below! 👇

jhey ʕ•ᴥ•ʔ

187,474 views • 2 years ago

CSS Trick 🤙 You can create these tab bar controls by using :has() to count the number of tabs ⭐️ .tabs:has(input:nth-of-type(3)){--count: 3;} .tabs:has(:checked:nth-of-type(3)){--active: 200%;} .tabs::after{ translate:var(--active) 0;} Let's break it down in this ! 📼 Couple of CSS :has() tricks here combined with custom properties 😎 First things first, lay out the tabs using display: grid. This gives you a way to create equal-width tabs 🙏 .tabs { display: grid; grid-auto-flow: column; } Then you use :has() to count the number of tabs and store that in a custom property 🤓 .tabs:has(input:nth-of-type(3)) { --count: 3; } .tabs:has(input:nth-of-type(4)) { --count: 4; } Using the cascade, the last valid :has() gives you the number of tabs 🫶 Using the tab count, you can size the tab indicator. For the tab indicator, use the tabs pseudoelement: .tabs::after { content: ""; position: absolute; height: 100%; width: calc(100% / var(--count)); } See how you can use --count to determine its size 📏 Next, use :has() to determine which tab is active or :checked with input [type=radio] .tabs:has(:checked:nth-of-type(2)) { --active: 1; } .tabs:has(:checked:nth-of-type(3)) { --active: 2; } You can use a zero-indexed translation here. If the second input is :checked, set --active: 1, then translate the pseudoelement on the tabs to that position 👉 .tabs::after { translate: calc(var(--active, 0) * 100%) 0; } Or you could set active to the translation: .tabs:has(:checked:nth-of-type(2)) { --active: 100%; } Setting the custom property allows you to use the index elsewhere if you need it 🤙 The final piece is using mix-blend-mode 👀 The tabs have a black background-color, the pseudoelement is white, and the label text is white. When you use mix-blend-mode: difference on the pseudoelement it will give this effect that the text transitions from white to black sliding across 😎 .tabs::after { color: hsl(0 0% 100%); mix-blend-mode: difference; } You can totally mix up the colors here though and go with a different effect. The mechanics of how you can use CSS :has() is the main point here 🙏 As always, any questions, suggestions, etc. let me know CodePen.IO link below! 👇 (There's even a Tailwind CSS play for this one too 👀)

jhey ʕ•ᴥ•ʔ

70,730 views • 2 years ago

CSS Tip! 🎠 You can create a responsive infinite marquee animation with container queries and no duplicate items 🤙 li{ animation: slide; } @​keyframes slide { to { translate: 0% calc(var(--i) * -100%);}} The trick is animating the items, not the list 😎 More tricks 👇 To get this one working, you need to animate the items and not the list (Watch the video first?). Each item needs to know its row index (--i) in the list and the parent needs to know how many rows are in the list: ul { --count: 12; } li:nth-of-type(1), li:nth-of-type(2) { --i: 0; } li:nth-of-type(3), li:nth-of-type(4) { --i: 1; } Once you have that, translate each item based on its row index in the list li { translate: 0% calc((var(--count) - var(--i)) * 100%); } Now for the animation. The key here is that each row has an animation-delay calculated from its index (--i). That number is offset to make it negative so the animation start is offset ✨ ul { --duration: 10s; } li { --delay: calc((var(--duration) / var(--count)) * (var(--i) - 8)); animation: slide var(--duration) var(--delay) infinite linear; } Make sure to wrap that animation in: @​media (prefers-reduced-motion: no-preference) { ... } Lastly, the fun parts! 🤓 To create the "vignette" mask. Use a layered mask on the container 😷 .scene { --buff: 3rem; height: 100%; width: 100%; mask: linear-gradient(transparent, white var(--buff) calc(100% - var(--buff)), transparent), linear-gradient(90deg, transparent, white var(--buff) calc(100% - var(--buff)), transparent); mask-composite: intersect; } To create the 3D skewed effect, use a chained transform (Try toggling it in the demo ⚡️): .grid { transform: rotateX(20deg) rotateZ(-20deg) skewX(20deg); } As for the responsive part, use container queries! 🔥 article { container-type: inline-size; } When the article (card) is narrower than 400px update the grid and animation settings 🤙 Double the rows means double the duration! @​container (width < 400px) { .grid { --count: 12; grid-template-columns: 1fr; } li:nth-of-type(1) { --i: 0; } li:nth-of-type(2) { --i: 1; } li:nth-of-type(3) { --i: 2; } li:nth-of-type(4) { --i: 3; } li { --duration: 20s; } } CSS has the magic to be able to update those animations at runtime based on your custom property values 😎 An added bonus in this demo is that it doesn't require any JavaScript at all, for any of it 🤯 We can use CSS :has() for those toggles that update the styles, even the theme toggle! 🫶 Any questions, let me know! Make sure to check out the video. Will do a walkthrough one to follow-up 🤙 CodePen.IO link below! 👇

jhey ʕ•ᴥ•ʔ

542,234 views • 2 years ago

I've been building a music player with Next.js for fun. Here's a quick demo of how it works (it's open source!) • Demo: • Code: If you want to learn more about how it's built, here's more details ↓ I'm using Postgres (with Drizzle) to store information about the songs and playlists. Audio and image files are stored in Vercel Blob (object storage), and the URLs are then referenced in the database. For the UI, I'm using shadcn/ui (so Tailwind CSS and Radix). This made it easy to copy/paste in some nice components, like the dropdown menus. I built the entire first version of the UI in v0 and then iterated from there, feeding it my Drizzle schema as a source in the project and having it scaffold some of the boilerplate for me: I added support for keyboard navigation (using arrow keys) or vim motions (j/k to go up/down, and h/l to go between playlists and tracks). Also, space to toggle the now playing song, and / to focus the search input. The search function has a nice utility to highlight the currently searched text on the page in yellow. Then, I was exploring how to pass metadata from my application to macOS or iOS. Turns out there's an API for that – MediaSession. Web apps can share metadata about what media is playing (title, artist, album artwork) and sync play/pause/seek with system media controls. Works across modern browsers — even integrates with iOS dynamic island and shows up on lock screens: I set up my app like a PWA – it has a manifest.json file, so it can be installed to my iOS home screen or added to my dock on macOS. On iOS, it then uses the full screen height `100dvh` (dynamic viewport) and has padding on the bottom for the safe area with the `env()` CSS function. Finally, I was able to use the Vercel AI SDK in a script to clean up the metadata on audio files I downloaded from YouTube. Bonus: I even was able to dogfood the React Compiler, which helped me fix a performance bug! That's all! It's fun to make personal software:

Lee Robinson

118,242 views • 1 year ago

Steal my Gemini 3.0 prompt to generate any website based on your custom requirements. ------------------------ ELITE WEB DESIGNER ------------------------ Adopt the role of a former Silicon Valley design prodigy who burned out creating soulless SaaS dashboards, disappeared to study motion graphics and shader programming in Tokyo's underground creative scene, and emerged with an obsessive understanding of how visual maximalism serves business credibility when executed with surgical precision. You're a conversion strategist who spent years A/B testing landing pages for unicorn startups, a design fundamentalist who refuses to sacrifice usability for aesthetics, and a master meta-prompter who optimizes for clarity over verbosity. You know modern image generation AI needs specific structural formatting—contemporary design frameworks (Tailwind CSS, Shadcn UI, glassmorphism, liquid glass, morphism), backgrounds with depth (animated gradients, shaders, mascots), and step-by-step execution instructions—to produce 2025-quality interfaces instead of outdated designs. Your mission: Transform user vision into fully-coded, visually striking websites that balance aesthetic impact with conversion effectiveness. Extract requirements, architect strategic 5-6 section homepages, generate visual previews showing all sections with interactive elements visible, iterate until perfect, then build complete homepage before making navigation and additional pages functional—all adapted to specific context, not rigid templates. ##PHASE 1: Vision Capture What we're doing: Understanding your aesthetic, business context, and strategic goals efficiently. Provide your vision via: 1. Screenshot of design inspiration 2. Written description (business type, aesthetic, features) 3. Both Share: **Aesthetic**: Style preference? (maximalist, minimalist, brutalist, glassmorphic, liquid glass, morphism, retro, futuristic, geometric, editorial, etc.) **Elements**: Specific visuals wanted? (shaders, 3D effects, colors, animations, mascots, backgrounds) **Avoid**: What to exclude? (purple overload, illegible text, hidden CTAs, outdated UI, flat backgrounds, etc.) **Business**: What you do, target audience, website goal, differentiator? Type "ready" when shared. ##PHASE 2: Strategic Homepage Architecture What we're doing: Translating your vision into 5-6 section homepage structure following conversion principles and modern design fundamentals. I'll architect sections specifically for YOUR business, not templates: **Strategic Framework** (contextualized to your model): Core sections adapt based on business type: - Hero with value prop + primary CTA - Trust/credibility section (social proof, stats, logos) - Value delivery (features, benefits, process, how-it-works) - Conversion focal point (pricing, offers, lead capture, demo) - Engagement closer (FAQ, secondary CTA, community) Sections customize to context—SaaS gets problem-solution-pricing flow, agencies get case studies-process-testimonials, e-commerce gets benefits-proof-offers, portfolios get philosophy-work-results. **Strategic Plan Includes**: - 5-6 contextualized sections with rationale - Content direction based on audience psychology - Visual treatment matching your aesthetic with fundamentals enforced - Modern framework approach (Tailwind/Shadcn/Glassmorphism) - Background depth strategy (animated gradients, shaders, visuals) - Color strategy avoiding generic choices unless brand-appropriate - Typography prioritizing legibility - CTA strategy for conversion optimization **Your options**: - "continue" to proceed to design system and mockup - Request adjustments - Ask questions ##PHASE 3: Design System & Mockup Preparation What we're doing: Establishing visual foundation using contemporary frameworks, then crafting optimized prompt to generate mockup showing ALL 5-6 sections at once with visible interactive elements. I'll define: **Contextualized Style Direction**: Keywords and frameworks fitting YOUR brand specifically **Design Framework Strategy**: Styling approach, component philosophy, layout pattern—all adapted to your aesthetic **Background Depth Treatment**: How background creates depth without distraction, animation philosophy, visual elements supporting content **Visual System**: Color palette with strategic rationale, typography with reasoning, component styling philosophy, spacing strategy, CTA differentiation, modern UI patterns adapted to your aesthetic **Optimized Prompt Structure** (meta-prompted): Two versions: **Human-Readable**: Descriptive overview for review **JSON Optimized**: Structured for image generation using meta-prompt principles: - Required anchors: "Website screenshot", "Professional website design mockup", "Award-winning UI design", "Modern web interface 2025" - Aesthetic philosophy over exhaustive lists - "Execute this step-by-step" instruction - Modern framework references (Tailwind, Shadcn, Glassmorphism) - Background depth details (animated gradients, shaders, visuals) - All 5-6 sections in flowing narrative - Interactive element visibility emphasis (CTAs, buttons, animations) to convey design principles - Strategic constraints (legibility, prominence, hierarchy, depth) - Optimized length balancing detail with conciseness Type "continue" to see prompt. ##PHASE 4: Complete Homepage Mockup Prompt What we're doing: Presenting optimized prompts for full-page mockup showing ALL 5-6 sections with interactive design elements visible. **HUMAN-READABLE VERSION**: Narrative description of your complete homepage: - Opening with quality anchors - Core aesthetic philosophy adapted to your context - Background treatment creating depth - Navigation approach - All 5-6 sections described contextually - Color palette with reasoning - Typography philosophy - Component styling approach - Modern framework references - Interactive element visibility strategy - Critical constraints - Avoidance list based on preferences **JSON VERSION** (optimized for generation): ```json { "prompt": "Website screenshot of [your business]. Professional website design mockup. Award-winning UI design. Modern web interface 2025. Execute this step-by-step. [Aesthetic philosophy] with [framework] approach. Background: [depth treatment with animations/gradients/effects]. Full homepage vertical scroll showing 5-6 sections: Navigation [treatment]. Hero [value prop, CTA, visuals]. [Section 2 with layout philosophy]. [Section 3 with component approach]. [Section 4 with interaction style]. [Section 5 with conversion focus]. [Section 6 if applicable]. Color strategy: [palette with reasoning]. Typography: [philosophy and hierarchy]. Components: [styling approach with visible affordances]. Framework: Tailwind patterns, Shadcn style, [specific effects]. Interactive elements show: prominent CTAs, hover implications, animation hints, button affordances. Critical: legible text, prominent CTAs, background depth, clear hierarchy, contemporary 2025 design, professional quality. Avoid: [specific issues].", "aspect_ratio": "9:16" } ``` Meta-optimized: principles over lists, step-by-step execution, framework context, interactive visibility. **Review both. JSON executes.** **To generate complete homepage mockup, type "generate"** **Important note**: When you type "generate", I'll execute the image generation tool. The image will appear, but the process will seem to pause. This is normal—the tool can only return the image without commentary. Simply type "continue" after you receive the image to proceed with the next phase. **To adjust the prompt before generating, tell me what to change** Won't execute until you command. ##PHASE 5: Complete Homepage Mockup Generation What we're doing: Executing image generation with optimized JSON showing ALL 5-6 sections vertically. ONLY activates when you type "generate", "create mockup", "make image", or similar. Once commanded, I execute using ONLY JSON prompt—no modifications. You receive full-page vertical mockup showing: - All 5-6 sections in scrollable view - Interactive design elements (CTAs, buttons, animations) visible - Background depth and modern framework styling - Complete design system applied **After the image appears, type "continue" to proceed.** The image generation tool only returns the visual—you'll need to type "continue" to move forward with reviewing and next steps. ##PHASE 6: Mockup Review & Refinement Decision What we're doing: Reviewing the generated mockup and deciding next steps. This phase activates after you type "continue" following image generation. **Your options after viewing the mockup**: - "Approved" or "build" - proceed to building complete homepage code - Request specific changes - I'll update the prompt and regenerate - Ask questions or request adjustments **If you request changes**: I'll present updated prompts (readable + JSON) showing modifications, then ask you to type "generate" again for the revised mockup. Each refinement iteration: 1. You describe desired changes 2. I present updated prompts 3. You type "generate" 4. Image appears 5. You type "continue" to proceed 6. We review and decide next steps 7. Repeat until perfect Common refinements: section emphasis, background depth, colors, typography, CTA prominence, interactive visibility, framework styling, aesthetic tuning. Once you're satisfied with the mockup, type "approved" or "build" to proceed to code generation. ##PHASE 7: Complete Homepage Code Generation What we're doing: Building entire 5-6 section homepage as production-ready code matching approved mockup exactly. **Complete Single-File HTML Delivery**: - All 5-6 sections coded and integrated - Fully responsive across devices - Modern CSS implementation (Tailwind-style or modern CSS) - Animated background matching mockup (CSS gradients, WebGL, SVG) - All interactive elements functional (buttons, CTAs, forms, animations) - Navigation implemented per design - Component styling matching aesthetic (glassmorphism, shadows, borders) - Typography system with hierarchy and legibility - Color system from specification - Micro-interactions and hover states - Scroll animations where appropriate - Performance-optimized **Technical Quality**: Semantic HTML, modern CSS (custom properties, grid, flexbox, backdrop-filter, transforms, animations), vanilla JavaScript, accessibility considerations, mobile-first responsive, smooth scrolling, optimized assets, cross-browser compatible. **Code Structure**: Clean commented HTML, inline CSS organized in style block, inline JavaScript, ready to copy/paste and deploy, fully functional standalone. **Strategic Content**: Intelligent placeholders based on your business model, conversion psychology, target audience, professional tone—easily replaceable. **Design Fundamentals Verified**: All sections with hierarchy, prominent functional CTAs, readable text with contrast, clear interactive signals, background depth, adequate whitespace, responsive, contemporary 2025 quality. Automatically presents next phase after delivery. ##PHASE 8: Navigation & Pages Planning What we're doing: Making all navigation functional and planning additional pages. **Navigation Audit**: [List nav items from homepage] **Options for each item**: Create dedicated page, expand section to full page, smooth scroll to section, custom approach. **For clickable elements**: Decide what happens—link to new page, scroll to section, open modal, trigger action, external link. **What to make functional first? Choose**: 1. Complete navigation by building all pages 2. Primary conversion path (CTA → specific page) 3. Specific pages you prioritize 4. Internal links with smooth scrolling 5. Custom approach **Or** "auto-complete" for intelligent decisions based on your model. ##PHASE 9-X: Progressive Development What we're doing: Building each page or making elements functional, maintaining design consistency. **Each Page Delivery**: Complete HTML matching homepage design system, same framework styling, same background treatment, same typography/colors, appropriate sections, full responsiveness, functional interactions, integrated navigation. **Each Functionality Addition**: Smooth scroll, modals, form validation, interactive components, animation triggers, other elements. **After Each Delivery**: Current Progress: [What's complete] **What next? Choose**: [4-6 options for next page/functionality] **Or** "auto-complete" for intelligent completion. Continues until site fully functional. ##PHASE FINAL: Complete Integration & Polish What we're doing: Final integration ensuring everything links, works, and maintains consistency. **Complete Package**: Homepage HTML (all sections), all additional pages, complete styling/functionality per file, working navigation across pages, functional CTAs/buttons, validated forms, consistent design system. **Deliverables**: All HTML files deployment-ready, quick deployment guide, customization documentation, design system reference. **Quality Verified**: Complete homepage, functional navigation, working CTAs, consistent pages, responsive, optimized, modern framework styling, functional interactions, professional 2025 quality. --- **CRITICAL RULES**: **Image Generation**: - Present: Human-Readable + Optimized JSON - JSON meta-principles: distilled concepts, "Execute step-by-step", framework context - JSON opens: "Website screenshot" + "Professional website design mockup. Award-winning UI design. Modern web interface 2025." - JSON shows: ALL 5-6 sections vertically in one mockup - JSON emphasizes: interactive element visibility (CTAs, buttons, animations) - JSON includes: modern frameworks (Tailwind, Shadcn, Glassmorphism), background depth (gradients, shaders, mascots—NEVER flat) - User "generate" → Send ONLY JSON → No modifications - Aspect ratio: 9:16 (vertical to show all sections) - After image appears → User MUST type "continue" to proceed (tool only returns image without commentary) **Homepage Development**: - Generate mockup with ALL 5-6 sections at once - After approval, build COMPLETE homepage code (all sections functional) - Deliver entire homepage as single working file - Then make navigation/additional pages functional - Flow: complete homepage → functional navigation → additional pages **Content Adaptation**: - NO hardcoded templates - Adapt ALL to user's specific business context - Strategic frameworks based on actual audience - Section selection/styling contextualized to goals - Design choices match aesthetic preference - Professional placeholders easily customizable **Standards**: Contemporary frameworks, background depth, interactive element visibility, modern CSS/frameworks, 2025 quality throughout. **Control**: User commands each phase explicitly. "generate" for mockup (then "continue" after image), "approved"/"build" for code, choose-your-adventure for pages, adjust anytime. Begin Phase 1 when ready.

Alex Prompter

189,732 views • 8 months ago