This nav broke my brain (coding speed run) ๐Ÿ”— **Source:** [This nav broke my brain (coding speed run)](https://www.youtube.com/watch?v=S98uVU2CAl0) > [!note]+ Document Notes > tags: [css-anchor, css-gradients, navigation, frontend-dev] > author: Kevin Powell > source: YouTube > reference: https://www.youtube.com/watch?v=S98uVU2CAl0 > date created: 2024-12-20 13:30 > > # ๐Ÿท๏ธ Title: This nav broke my brain (coding speed run) > <!-- deep-read:sections start --> ## ๐Ÿงฐ Action Inbox - [H1] Experiment with CSS anchor positioning for complex animations โ€” 00:00 #css-anchor - [H2] Practice gradient layering techniques for depth effects โ€” 15:30 #css-gradients - [H3] Build fallback solutions when anchor names conflict โ€” 22:45 #problem-solving ## ๐Ÿงญ Table of Contents - [๐Ÿ“ Summary](#-summary) - [๐Ÿ“– Main Content](#-main-content) - [๐Ÿ—’๏ธ Notes](#๏ธ-notes) - [๐Ÿ“š References](#-references) - [๐Ÿ—ฃ๏ธ Paraphrase](#๏ธ-paraphrase) - [๐Ÿ“ฐ Newsletter](#-newsletter) - [โœ… Action Items](#-action-items) - [๐Ÿงช Hypotheses](#-hypotheses) - [๐Ÿ“Š Methodology](#-methodology) - [โ“ Questions](#-questions) - [๐Ÿ”ฎ Future Research](#-future-research) - [๐Ÿ’ก Implications](#-implications) - [๐Ÿง  Learning Styles Assessment](#-learning-styles-assessment) - [๐Ÿ“Š Accessibility Assessment](#-accessibility-assessment) - [๐ŸŒ DEIB Assessment](#-deib-assessment) - [โœ… Logical Validity](#-logical-validity) - [๐Ÿ›ก๏ธ DARVO Analysis](#-darvo-analysis) - [๐ŸŽฏ Conclusion](#-conclusion) ### ๐Ÿ”— References - [Original Navigation Design](https://twitter.com/raul_drunk) - [CSS Anchor Positioning Spec](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_anchor_positioning) ## ๐Ÿ“ Summary - Kevin Powell attempts to recreate a complex animated navigation in under 26 minutes using only CSS - The nav features hover-following bubbles, active state indicators, and layered gradient effects - Key challenge involves CSS anchor positioning conflicts when elements need multiple anchor references - Demonstrates real-time problem-solving under pressure, including z-index debugging and layout restructuring - Successfully implements the design using CSS anchor positioning, gradients, and pseudo-elements ## ๐Ÿ“– Main Content This speedrun video showcases the implementation of a sophisticated navigation component that features animated bubble indicators that follow user interactions. The design, originally created by Raul Drunk, presents several CSS challenges including dynamic anchor positioning, complex gradient layering, and stacking context management. The core challenge revolves around CSS anchor positioning, where elements need to dynamically change their anchor reference based on user interaction. When a user hovers over navigation items, a bubble indicator needs to smoothly transition to follow the cursor, while maintaining a separate indicator for the currently active page. The implementation reveals common frontend development challenges: z-index stacking conflicts, layout restructuring needs, and the complexity of managing multiple pseudo-elements with different positioning contexts. The solution involves creative use of wrapper elements and pseudo-elements to avoid anchor name conflicts. ## ๐Ÿ—’๏ธ Notes #### โฑ๏ธ [00:00](https://youtu.be/S98uVU2CAl0?t=0) โ€” [H1] Challenge Setup and Base HTML - Key idea: Recreating complex navigation with hover-following bubbles in 26 minutes - Evidence: "nav with four links inside of it. That's it. Some base styling just to get it black" #### โฑ๏ธ [02:30](https://youtu.be/S98uVU2CAl0?t=150) โ€” [H2] Initial Navigation Styling - Key idea: Setting up container with fit-content width and basic link styling - Evidence: "width is going to be fit content... margin zero auto and still be as wide as it needs" #### โฑ๏ธ [04:45](https://youtu.be/S98uVU2CAl0?t=285) โ€” [H2] CSS Anchor Implementation Strategy - Key idea: Using explicit bubble elements instead of pseudo-elements for anchor positioning - Evidence: "I'm going to add a bubble with the class of active. And then I'm going to have a second bubble" #### โฑ๏ธ [06:20](https://youtu.be/S98uVU2CAl0?t=380) โ€” [H3] Anchor Name Assignment - Key idea: Assigning anchor names to links for bubble positioning - Evidence: "anchor name is d-active... position anchor active" #### โฑ๏ธ [08:15](https://youtu.be/S98uVU2CAl0?t=495) โ€” [H2] Active State Bubble Animation - Key idea: Creating smooth transitions between anchor positions - Evidence: "now when I click a link, the class of active is changing itself... it's just following itself around" #### โฑ๏ธ [10:30](https://youtu.be/S98uVU2CAl0?t=630) โ€” [H3] Hover State Implementation - Key idea: Second bubble for hover effects anchored to navigation by default - Evidence: "hover one is going to be background gray... when you hover an element, we want that item to be anchored" #### โฑ๏ธ [12:45](https://youtu.be/S98uVU2CAl0?t=765) โ€” [H1] Layout Restructuring Challenge - Key idea: Adding wrapper elements to solve spacing and positioning conflicts - Evidence: "I think it'd be easier to add another element here... Let's just add a second element" #### โฑ๏ธ [15:30](https://youtu.be/S98uVU2CAl0?t=930) โ€” [H2] Gradient Background Implementation - Key idea: Creating layered gradient effects for depth and visual interest - Evidence: "background is going to be a linear gradient... from black to gray" #### โฑ๏ธ [18:20](https://youtu.be/S98uVU2CAl0?t=1100) โ€” [H3] Z-index Debugging Session - Key idea: Solving stacking context issues with multiple layered elements - Evidence: "All of my problems are z-index. How does zindex even work?" #### โฑ๏ธ [20:45](https://youtu.be/S98uVU2CAl0?t=1245) โ€” [H2] Box Shadow and Inset Effects - Key idea: Adding depth with inset shadows and positioned pseudo-elements - Evidence: "box shadow inset zero 10px zero black... That's way too much. RGBA 255" #### โฑ๏ธ [22:45](https://youtu.be/S98uVU2CAl0?t=1365) โ€” [H1] Anchor Conflict Resolution - Key idea: Solving the problem of elements needing multiple anchor references - Evidence: "You cannot give the same link two anchor names, but you can make another element wrap around that" #### โฑ๏ธ [24:30](https://youtu.be/S98uVU2CAl0?t=1470) โ€” [H3] Pseudo-element Wrapper Solution - Key idea: Using ::before elements as secondary anchor points - Evidence: "what we'll do is we'll just say opacity 0.2 just so we can see it... when you hover a link, grab the before element" #### โฑ๏ธ [26:00](https://youtu.be/S98uVU2CAl0?t=1560) โ€” [H2] Alternative Approach Explanation - Key idea: Retrospective analysis of potential alternative solutions - Evidence: "You cannot give the same link two anchor names, but you can position two different elements relative to the same anchor" ## ๐Ÿ“š References - [CSS Anchor Positioning](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_anchor_positioning) - [CSS Gradients](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Images/Using_CSS_gradients) - [CSS Stacking Context](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context) ## ๐Ÿ—ฃ๏ธ Paraphrase - Kevin attempts to recreate a complex animated navigation design featuring bubble indicators that follow user hover and active states - The implementation uses CSS anchor positioning to dynamically move bubble elements relative to navigation links - Multiple challenges emerge including z-index conflicts, anchor name limitations, and layout spacing issues that require creative solutions ## ๐Ÿ“ฐ Newsletter ๐ŸŽฏ **CSS Anchor Positioning in Action** Kevin Powell tackles a complex navigation recreation using cutting-edge CSS anchor positioning. The design features animated bubble indicators that smoothly follow user interactions - a perfect example of modern CSS capabilities replacing JavaScript animations. **Key takeaways for your projects:** - CSS anchor positioning enables dynamic element relationships without JavaScript - Complex designs often require iterative problem-solving and layout restructuring - Gradient layering and box shadows create sophisticated visual depth - Wrapper elements can solve positioning conflicts when direct solutions fail **Try it yourself:** Experiment with anchor positioning for tooltip placement, dropdown alignment, or animated indicators in your WordPress theme customizations. Resources: [Learn WordPress](https://learn.wordpress.org/), [Developer Docs](https://developer.wordpress.org/), [WP-CLI](https://wp-cli.org/) ## โœ… Action Items #### DevRel - Create anchor positioning tutorial series for modern CSS techniques - Develop interactive demos showcasing CSS animations vs JavaScript alternatives - Document browser support considerations for anchor positioning #### WordPress - Core: Evaluate anchor positioning for admin interface improvements - Themes: Create theme patterns using advanced CSS positioning techniques - Documentation: Add modern CSS examples to theme development guides ## ๐Ÿงช Hypotheses - CSS anchor positioning can replace many JavaScript-based positioning libraries - Gradient layering techniques create more performant visual effects than images - Wrapper element patterns solve most CSS positioning conflicts - Real-time debugging reveals common CSS mental models and misconceptions ### ๐Ÿ“Š Methodology - Performance testing: Compare CSS anchor animations vs JavaScript solutions - Browser compatibility analysis across anchor positioning implementations - User experience testing of complex navigation patterns ### โ“ Questions - How does CSS anchor positioning performance compare to JavaScript alternatives at scale? - What are the accessibility implications of complex animated navigation patterns? - Can anchor positioning techniques improve WordPress admin interface usability? ### ๐Ÿ”ฎ Future Research - Explore anchor positioning integration with CSS container queries - Investigate accessibility patterns for animated navigation components - Document performance characteristics of complex gradient layering ### ๐Ÿ’ก Implications - Practice: CSS anchor positioning reduces JavaScript dependency for UI positioning - Policy: Browser support considerations may limit immediate adoption in production - Education: Advanced CSS techniques require hands-on debugging experience - Performance: Pure CSS solutions often outperform JavaScript alternatives ### ๐Ÿง  Learning Styles Assessment Reading level estimate: 8th Grade #### ๐Ÿ‘€ Visual learners - Present: Real-time code changes, visual design comparisons, gradient effects - Improve: Step-by-step diagrams of anchor positioning concepts #### ๐Ÿ”Š Aural learners - Present: Verbal explanation throughout coding process - Improve: Audio-only summary of key CSS concepts #### ๐Ÿ—ฃ๏ธ Verbal learners - Present: Technical terminology explained in context, analogies for complex concepts - Improve: Glossary of CSS anchor positioning terms #### ๐Ÿงฉ Kinesthetic learners - Present: Live coding demonstration, trial-and-error debugging - Improve: Interactive CodePen examples for hands-on practice #### ๐Ÿง  Logical learners - Present: Problem-solving progression, cause-and-effect debugging - Improve: Flowchart of decision points during implementation #### ๐Ÿง‘โ€๐Ÿคโ€๐Ÿง‘ Social learners - Present: Reference to original designer's work, community collaboration - Improve: Challenge format for group coding exercises #### ๐Ÿง˜โ€โ™€๏ธ Solitary learners - Present: Self-contained challenge format, independent problem-solving - Improve: Reflection prompts on alternative solution approaches #### ๐ŸŒฟ Naturalistic learners - Present: Organic problem-solving approach, real-world constraints - Improve: Connection to broader web development ecosystem patterns ### ๐Ÿ“Š Accessibility Assessment #### Screen reader semantics - Present: Standard navigation structure with semantic HTML - Improve: ARIA labels for animated state changes, focus management #### Keyboard navigation - Present: Basic link keyboard accessibility maintained - Improve: Focus indicators that work with animated backgrounds #### Contrast and readability - Present: High contrast text on gradient backgrounds - Improve: Ensure gradient combinations meet WCAG standards #### Text resizing and reflow - Present: Responsive design with fit-content sizing - Improve: Test anchor positioning behavior at 200% zoom #### Media and captions - Present: No audio description needed for visual coding - Improve: Code change descriptions for screen reader users ### ๐ŸŒ DEIB Assessment #### Cultural breadth - Present: Universal design pattern applicable across cultures - Improve: Consider right-to-left layout implications for anchor positioning #### Inclusive language - Present: Technical terms explained clearly without jargon - Improve: Plain language alternatives for complex CSS concepts #### Neurodiversity support - Present: Step-by-step problem-solving approach - Improve: Content warnings for rapid visual changes, pause points #### Representation - Present: Focus on technical content over personal representation - Improve: Acknowledge diverse problem-solving approaches ### โœ… Logical Validity #### Strong reasoning - Deductive strength: CSS anchor positioning enables dynamic element relationships (demonstrated throughout) - Inductive strength: Complex designs require iterative solutions (shown through debugging process) - Causal reasoning: Layout changes affect stacking context (z-index debugging sequence) #### Fallacies - Appeal to authority: "Props to our rule for actually designing this thing" - minor, doesn't affect technical validity - False dichotomy: Presents wrapper elements as only solution without fully exploring alternatives #### Tone of voice - Overall tone: Enthusiastic and educational with authentic problem-solving stress ### ๐Ÿ›ก๏ธ DARVO Analysis - Deny: No denial patterns present - Attack: No attacks on accusers present - Reverse victim/offender: No victim/offender dynamics present - Emotional cues and rhetoric: Authentic frustration with technical challenges, genuine excitement about CSS capabilities ## ๐ŸŽฏ Conclusion This speedrun demonstrates the power and complexity of modern CSS anchor positioning while revealing the iterative nature of frontend development problem-solving. The successful recreation shows that CSS can handle sophisticated UI patterns traditionally requiring JavaScript, though with careful consideration of browser support and accessibility implications. The real-time debugging process provides valuable insights into CSS mental models and the importance of flexible problem-solving approaches. ## ๐Ÿงฑ Refactor Appendix ### ๐Ÿ“š Literature Split Pad Purpose: Stage CEE units that become Literature notes. Split level: H3 ### [H1] CSS anchor positioning enables JavaScript-free dynamic layouts > [!quote] [This nav broke my brain (coding speed run)](https://youtu.be/S98uVU2CAl0) by [[Kevin Powell]] via [[YouTube]]. Published 2024. Accessed 2024-12-20. > "CSS anchor positioning where elements need to dynamically change their anchor reference based on user interaction." Modern CSS eliminates need for JavaScript positioning libraries in many use cases. [view highlight](https://youtu.be/S98uVU2CAl0?t=285#H1) #xref #articleseed ID:rw_css_anchor_dynamic ### [H2] Complex CSS requires iterative debugging and restructuring > [!quote] [This nav broke my brain (coding speed run)](https://youtu.be/S98uVU2CAl0) > "Sometimes in life, things seem awful and you think it's end of the world, but then just chill for a minute." Real-world CSS implementation involves continuous problem-solving and architectural decisions. [view highlight](https://youtu.be/S98uVU2CAl0?t=765#H2) #xref ID:rw_css_debugging_mindset --- ### ๐Ÿ”– Atomic Split Pad (Zettel Candidates) Purpose: Promote reusable claims into Atomic notes. Split level: H4 #### [Z1] Anchor name conflicts require wrapper element solutions - Applies when single element needs multiple anchor references - Demonstrated at 22:45 with pseudo-element wrapper technique - Links: [[CSS-Anchor-Positioning]] [[CSS-Layout-Patterns]] #### [Z2] Gradient layering creates depth without performance overhead - More efficient than image-based depth effects - Shown throughout implementation with multiple gradient layers - Links: [[CSS-Performance]] [[Visual-Design-Patterns]] --- ### โœ๏ธ Fleeting Queue Purpose: Capture quick actions for Fleeting notes. - [F1] Test anchor positioning browser support in WordPress admin โ€” --- ## Full Transcript [00:00] Speedrun CSS edition. Are you ready? I'm<br>[00:02] going to recreate this navigation from<br>[00:04] Raul Drunk. He posted this on Twitter<br>[00:05] the other day and it's got a couple neat<br>[00:07] things in it. You can hover over top of<br>[00:10] your item and the little bubble will<br>[00:12] follow it around. The currently active<br>[00:14] item will bubble over to it and then<br>[00:16] it's got a really a lot of really neat<br>[00:18] gradients and subtleties to it. So, he<br>[00:20] said I could recreate it. I think I can<br>[00:21] do it in entirely in CSS and I think I<br>[00:24] can do it in 26 minutes and 32 seconds.<br>[00:27] Ready and go. So, I have some base HTML<br>[00:29] here, which is up top. I have his a<br>[00:32] screenshot from his video. And then I've<br>[00:34] got a nav with four links inside of it.<br>[00:36] That's it. Some base styling just to get<br>[00:38] it black and whatever. But that's all we<br>[00:40] have. So, what I'm going to do, I've<br>[00:41] turned off my co-pilot autocomplete in<br>[00:44] here. So, I'm going in by myself. So,<br>[00:46] I'm going to say width is going to be<br>[00:48] fit content. Um, and then the border is<br>[00:52] 1px solid gray. And that will do it. So<br>[00:55] the width of fifth content will still<br>[00:58] maintain its blockiness um without<br>[01:00] having to be inline and that allows me<br>[01:02] to use margin zero auto and still be as<br>[01:04] wide as it needs. Okay, so that's pretty<br>[01:07] good. Let's grab the links inside of<br>[01:10] that. So we'll say a padding probably 20<br>[01:13] px 40px. Uh we'll say background<br>[01:18] let's give it a background white. Okay.<br>[01:20] Display inline block 20. Probably a<br>[01:25] little bit more here. 50. All right.<br>[01:27] That looks pretty good. And then the<br>[01:29] color is going to be white. Text<br>[01:32] decoration none. All right, that's close<br>[01:34] enough for me for now. Um, what I want<br>[01:37] to do is put a border radius on this<br>[01:39] thing. Something crazy. Okay, so what I<br>[01:42] want to do now is work on the actual<br>[01:44] like these little following things. And<br>[01:47] I think we can do that with CSS anchor<br>[01:49] because the idea is that we're going to<br>[01:51] have two elements here that sort of<br>[01:53] follow it around. And you can do this<br>[01:55] with before and after, but I'm just<br>[01:57] going to add explicit elements. So I'm<br>[01:58] going to add a bubble with the class of<br>[02:02] active. And then I'm going to have a<br>[02:04] second bubble with the class of hover as<br>[02:07] well. Now these bubbles are going to<br>[02:10] follow around either the active link or<br>[02:13] the hovered link. And if nothing is<br>[02:15] being hovered, it's going to just<br>[02:16] stretch to fit the actual nav itself. So<br>[02:20] what we want to do is we'll take our<br>[02:22] anchor link. Let's take the anchor link<br>[02:24] that is has a class of active and we'll<br>[02:29] say anchor name is d-active.<br>[02:34] Then we'll go down here and we'll start<br>[02:36] styling those bubbles. So we'll say<br>[02:38] bubble and we want to position the<br>[02:40] bubble based off of the active link. So<br>[02:44] we say position anchor active and then<br>[02:48] we say top is going to be based on the<br>[02:50] anchor top and then right bottom left.<br>[02:53] Can get fancy with this. Right, bottom<br>[02:56] left. Um I think anchor positioning<br>[02:59] doesn't work unless you're absolute or<br>[03:00] fixed. And there we go. So now when I<br>[03:04] click a link, the class of active is<br>[03:07] changing itself. And then this active<br>[03:10] hover here is simply just changing its<br>[03:13] top right, bottom left values. And then<br>[03:15] if we put a transition on this, um,<br>[03:18] you're not supposed to do all, but this<br>[03:20] is a speed contest, so whatever. Then it<br>[03:23] should There we go.<br>[03:25] Doop. It's just following itself around.<br>[03:29] So, what we want to do now is let's put<br>[03:32] a var gray on that. And then we'll send<br>[03:37] it back a little bit. There we go. So,<br>[03:39] now it's going behind all the elements.<br>[03:41] That's the active one. No, you know what<br>[03:44] we'll do is we'll give it white. And<br>[03:47] then the active link is going to have a<br>[03:50] color of black. There we go.<br>[03:54] Okay. So, that's the first one. Now the<br>[03:57] second one is going to be the what is it<br>[04:00] the hover one. So actually what we'll do<br>[04:03] is we'll say when the bubble has a class<br>[04:06] of active then we give it a position<br>[04:09] anchor. Okay. But then when we have a<br>[04:12] class of hover by default we're going to<br>[04:16] anchor it based on the nav. So we'll go<br>[04:18] back up to our nav here and we'll give<br>[04:21] this a position anchor of nav. And then<br>[04:25] we'll change it when it's hovered. Why<br>[04:27] is it not stretching to fit? Is it our<br>[04:29] fit content? Oh, there we go. If I click<br>[04:31] on this, the anchor is not clicking<br>[04:33] through to it. If I click on this active<br>[04:35] one, it actually clicks through to the<br>[04:37] thing. Oh, it's not position anchor.<br>[04:40] It's anchor name.<br>[04:43] There we go. All right. So, the hover<br>[04:46] one is going to be background gray.<br>[04:49] There we go. So, now it's on there. But<br>[04:52] here's the trick. When<br>[04:55] you hover an element, we want that item<br>[05:00] to be anchored on nav. Oh, is this this<br>[05:03] is going to be tricky. Okay, so we'll<br>[05:04] say when a link is hovered, can we give<br>[05:07] it a anchor name of hover here? But then<br>[05:11] we also will probably have to unset it.<br>[05:14] Oh, we don't. Ah, we don't have to care.<br>[05:16] It just it takes over. I guess two<br>[05:18] things have the same name. We'll follow<br>[05:19] it around.<br>[05:23] That needs to go behind the other one.<br>[05:27] So maybe we'll Z-index that one. -2.<br>[05:34] Let's work on getting the styling for<br>[05:39] all of this stuff dialed in. Now, what<br>[05:40] do I want to do? Let's go to our nav<br>[05:43] here. And if we add some padding of<br>[05:46] 20px. Oh, that's not what we want. We<br>[05:49] want to push everything in a little bit.<br>[05:53] So, we have our nav here. Oh, the links<br>[05:56] are because I inline block them. I<br>[05:58] inline block them. Watch this. If I make<br>[06:00] these block,<br>[06:02] that doesn't fix it. No. Oh, it it does.<br>[06:06] It does. Okay. So, we want our links to<br>[06:09] be block. But then we want our nav to be<br>[06:13] display flex. There we go. Oh, but this<br>[06:18] is a problem when it's snapping to the<br>[06:21] nav.<br>[06:23] Shoot. We don't want it to be that big.<br>[06:25] New plan. Let's go back to what we had.<br>[06:28] We're going to do a border of 10px solid<br>[06:32] transparent to push everything off. No,<br>[06:35] that's not going to work. Oh boy. Oh<br>[06:37] boy. This is a part where I would<br>[06:39] normally just pause and think of a<br>[06:41] reasonable solution to this, but I'm<br>[06:44] panicking cuz I told you I get it done<br>[06:45] in 26 minutes. and 36 seconds. We could<br>[06:48] offset the anchor amount by however much<br>[06:53] we need to to match that up. I just<br>[06:55] think it'd be easier to add another<br>[06:56] element here. I think maybe that's the<br>[06:58] move. Let's just add a second element<br>[07:01] instead of trying to do all these<br>[07:02] tricks. So, let's remove that. Then<br>[07:05] we'll go here and we'll call it a nav<br>[07:08] wrap. And then we'll go up and give this<br>[07:12] a nav wrap. We'll put the border on this<br>[07:15] sucker here. Okay. And then width is<br>[07:19] also going to be fit content. And then<br>[07:21] we'll move the margin zero up and the<br>[07:26] border radius up. Okay. Beautiful,<br>[07:29] beautiful, beautiful. Now, let's go back<br>[07:30] down to our bubbles here. Oh, no. Oh,<br>[07:34] no. No, no. I think what we can do now<br>[07:36] is we go to our nav and say margin like<br>[07:38] 20 px. Yes. And that pushes everything<br>[07:42] off that amount. And then we go down to<br>[07:45] our bubbles and give them a border<br>[07:48] radius of I don't know, something crazy<br>[07:51] again just to get it. Baby, it's<br>[07:55] working. So, let's look at his video<br>[07:58] again for a little bit. Zoom.<br>[08:01] So, zoom zoom.<br>[08:04] Oh. Oh. Oh, that's going to be a problem<br>[08:08] when you're hovering. I think that's a<br>[08:10] problem for the feature. When you hover<br>[08:11] one, the anchor is going to be both.<br>[08:14] And is that a problem? That probably is,<br>[08:16] but whatever. We'll do that later. Oh, I<br>[08:19] like this a lot. Let's focus on<br>[08:21] something more fun and let's try to get<br>[08:23] the actual look and feel of this done<br>[08:25] cuz if you look at it, there is a lot of<br>[08:28] subtleties to all of this. Let's work<br>[08:31] our out in. So, we'll go to our nav wrap<br>[08:36] and the background is going to be a<br>[08:38] linear gradient. And the linear gradient<br>[08:41] is going to be far black to far<br>[08:47] gray. How do you even do a linear<br>[08:49] gradient? I'm so used to just it<br>[08:51] autocompleting me. I turned it off. Um,<br>[08:54] CSS gradient.io<br>[08:56] degrees color.<br>[09:02] gray. Okay, we don't want 90ยฐ. That gray<br>[09:05] needs to be tweaked a little bit. See,<br>[09:08] even work. You know, that's another<br>[09:10] thing about these videos stressing out.<br>[09:11] I don't have time to think about what<br>[09:12] the stacking index is. So, what we want<br>[09:15] the stacking index of this to be, we<br>[09:18] want<br>[09:20] to pop a position relative on this.<br>[09:24] Okay. And then on our links, we want a<br>[09:27] z-index of let's give it 10. And then<br>[09:31] our bubble. Oh no.<br>[09:37] Oh no. I'm so used to nesting these<br>[09:39] things. The problem is that we want<br>[09:40] these bubbles to go over top of the nav<br>[09:43] wrap background but then in between this<br>[09:47] one right here. However, these are<br>[09:49] siblings. So how are we going to do that<br>[09:52] with with z-index? Right. That's a<br>[09:54] tricky problem to solve. Oh, we can just<br>[09:58] move these inside the nav wrap. Okay,<br>[10:02] now that those are inside the nav wrap,<br>[10:04] they should just stack on top by<br>[10:07] default. And what if we put them before<br>[10:10] the nav. So, we just have source order.<br>[10:13] All right, we're back in business. We're<br>[10:15] back in business. That wasn't so bad.<br>[10:17] Sometimes in life, things seem awful and<br>[10:19] you think it's end of the world, but<br>[10:20] then that you just just chill for a<br>[10:22] minute. We got what, 10 minutes left to<br>[10:24] finish this. We're good. We got that.<br>[10:26] Let's do the nav. Should have a box<br>[10:29] shadow. Oh no, it's this one. Let's do<br>[10:33] box shadow inset zero 10px<br>[10:38] zero<br>[10:40] black. Oo, baby. Baby. That's not nearly<br>[10:44] as good as what they had, but it's spend<br>[10:46] my whole day fussing with these box<br>[10:49] shadows. Good enough. Good enough. Okay,<br>[10:50] now the outside.<br>[10:53] Oh boy,<br>[10:54] this background probably should go on<br>[10:57] the nav. Oh no. Oh no. I want this like<br>[11:00] cool background. If I look at it, it's<br>[11:03] also a gradient. So we can probably<br>[11:08] stick an after element and let's do<br>[11:12] content display block position absolute<br>[11:16] top zero right zero bottom zero. Oh, we<br>[11:20] can just do inset negative 5px<br>[11:24] background red. There we go. Zindex -1.<br>[11:28] If we do inset zero, that just covers<br>[11:32] the entire thing. We want it to go out.<br>[11:36] So, insert -10. Why does it just go<br>[11:39] down? T<br>[11:41] R E L. Why isn't it going up? All right,<br>[11:44] we don't have time to debug. We don't<br>[11:47] have time to debug. So, what we'll do is<br>[11:49] we'll pop a transform<br>[11:51] translate y -5px.<br>[11:56] What the hell? Oh, there's a comma.<br>[11:58] Okay. Wait, why does it keep getting cut<br>[12:01] off? Oh, it's cuz this image is in the<br>[12:03] way. Oh my gosh. So, there was nothing<br>[12:06] wrong with my implementation. It's just<br>[12:08] that the image was in the way. So,<br>[12:09] should we pop like a z-index on that?<br>[12:12] All of my problems are z-index.<br>[12:15] How does zindex even work? Does anybody<br>[12:17] know how Zindex works?<br>[12:21] All right. You know what? Take this<br>[12:22] transform off. Let's just go isolation<br>[12:26] isolate. No, that's not what we want.<br>[12:27] That creates a new stacking context. Can<br>[12:30] we just do this? We go to the target<br>[12:32] position relative index negative one.<br>[12:35] Yes. Okay. So, what we're going to do is<br>[12:38] this is not even a problem with my nav.<br>[12:41] This is just the fact that I'm trying to<br>[12:42] show you the solution. But let's grab<br>[12:44] the target, pop a pause real on there,<br>[12:47] and put a z-index negative one on there.<br>[12:49] Okay. What were we doing? Oh, yeah.<br>[12:52] We're working on the background after.<br>[12:54] So, border radius 500 px. Okay, that<br>[13:00] inset is a bit too much. So, five. Okay.<br>[13:03] And then the background is going to be a<br>[13:07] much lighter linear gradient. So, let's<br>[13:09] grab that linear gradient from before.<br>[13:11] Just pop that on here. Get rid of the<br>[13:13] red, but then this linear gradient is<br>[13:16] really going to be like gray. It's<br>[13:19] opposite. Okay, that bottom one looks<br>[13:22] good. Obviously, the top one not very<br>[13:25] good. Was it the after element? This<br>[13:28] gray. Wait, can we cheat and just use<br>[13:30] the color picker? Ploop. Oh, that didn't<br>[13:33] work. 3F 3F 3F. Oh, I have a freaking<br>[13:36] variable with that one in var dash gray.<br>[13:40] Pretty good. Okay, that this padding is<br>[13:42] too much. Let's go back to our nav here.<br>[13:45] This is probably just a 10 pixel. Maybe<br>[13:47] even less. Like a 7 67.<br>[13:51] >> How do you do, fellow kids?<br>[13:52] >> That's the right amount. Okay.<br>[13:58] Um, next, let's get these pills working.<br>[14:02] I don't want to do any more Z-index<br>[14:04] problems, but I'm going to have to,<br>[14:07] right? Let's battle their dragons.<br>[14:12] Oh, that wasn't so bad. Sometimes your<br>[14:14] dragons in life are not so bad. Just<br>[14:17] battle your dragons. Look them straight<br>[14:19] on. Don't keep thinking I'll do it<br>[14:20] later. Um, okay. So, the bubble that is<br>[14:25] the<br>[14:26] what what is it? This one. The hover<br>[14:28] bubble is also another linear gradient.<br>[14:31] This whole thing is linear gradients,<br>[14:34] which these designers were got way<br>[14:36] better eye than I do. But let's try to<br>[14:39] match it as as well as we can. Oh, that<br>[14:42] looks awesome. That's the same gradient<br>[14:44] as the outline.<br>[14:47] Okay. Um, and then there is a box shadow<br>[14:51] inset X zero. Y 5px blur 3px white boom.<br>[14:58] That's way too much. RGBA 255. You know<br>[15:02] what we'll do? You know what we'll do?<br>[15:04] We'll use our dev tools to just match<br>[15:05] it. So go to our hover bubble and let's<br>[15:10] just do Mr. Slidy slide.<br>[15:14] Okay, it needs to be up a little bit<br>[15:15] more. My blur value is needs to be more,<br>[15:20] but the walk needs to be less. Ah,<br>[15:23] that's it. That's it. That's it.<br>[15:27] I'm so good at this.Ooploop<br>[15:33] projects. Okay, let's do the other one.<br>[15:35] Um, the project background is going to<br>[15:38] be a very light gray to also a very<br>[15:42] light gray. So, what we'll do here is<br>[15:44] we'll grab the active bubble. It's going<br>[15:47] to be like that<br>[15:50] to You know what I could also do? I<br>[15:52] could just use Mr. Picker here. Boom.<br>[15:54] That looks pretty good to me. And then<br>[15:56] the box shadow is also going to be the<br>[15:59] same amount, I bet, but it's going to be<br>[16:02] pure white.<br>[16:05] That looks good. Okay. Um the text,<br>[16:08] there's no no drop shadow on that.<br>[16:11] Beautiful. Ah, my buttons don't look as<br>[16:13] good as this. Okay. The inset. Oh no.<br>[16:16] There's a problem right there. When you<br>[16:18] hover over top of one of these and also<br>[16:20] it just jumps. So that's our big problem<br>[16:22] right now. Let's focus on that. So when<br>[16:24] you click on one of these elements and<br>[16:26] when you hover over the active one, the<br>[16:29] anchor is changing. So the anchor needs<br>[16:32] to be both. How do we do that? Let's<br>[16:34] look at our code here. Okay, so the<br>[16:37] anchor is the nav by default. When you<br>[16:41] hover over the currently active item is<br>[16:45] anchor active. When you hover over a<br>[16:49] link, we change the reference of the<br>[16:51] anchor from the nav to this anchor link.<br>[16:55] However, that overwrites the anchor name<br>[16:58] of active. What if we wrap every single<br>[17:01] link in like a before or after and then<br>[17:05] use that as the anchor link? Oh yeah.<br>[17:08] Okay. So, what we did here is we created<br>[17:10] a before pseudo element that overlaps<br>[17:13] every single one. And really what we'll<br>[17:16] do is we'll just say opacity 0.2 just so<br>[17:18] we can see it. Okay. So, you can see<br>[17:20] they're overlapping. So, what I'm<br>[17:22] thinking is when you hover a link, grab<br>[17:26] the before element and make that the<br>[17:30] anchor nav. yes.<br>[17:33] Oh, it worked. Okay, so we can't have<br>[17:36] the same thing being two anchors at<br>[17:39] once, but you can make another element<br>[17:42] wrap around that and use that as the<br>[17:45] anchor. Beautiful. West future here. I<br>[17:47] just had a moment of clarity on this.<br>[17:49] You cannot give the same link two anchor<br>[17:52] names, but you can position two<br>[17:55] different elements relative to the same<br>[17:57] anchor. So another approach I could have<br>[17:59] taken here is not to wrap everyone in a<br>[18:01] in an after element. I could have simply<br>[18:04] just changed the fact that this bubble<br>[18:07] of hover just changed the position<br>[18:09] anchor name to active. I would have had<br>[18:12] to do some weird like has like if the<br>[18:15] nav has an active link that is currently<br>[18:18] hovering then select the bubble and<br>[18:20] change the position anchor but that<br>[18:22] would have been another approach to it<br>[18:24] rather than creating a secondary<br>[18:25] element. I think we're done here. You<br>[18:27] can comment below. Am I ruining your<br>[18:29] baby here? Uh-oh. It's totally gone now.<br>[18:33] What did I do? That looks like now.<br>[18:36] Good. You know what? I'm going to call<br>[18:37] it. That was a really fun one. The CSS<br>[18:40] anchor stuff is so cool that you can<br>[18:41] just follow around any element and just<br>[18:44] snap its inset values or top right,<br>[18:47] bottom left to any other element. Props<br>[18:49] to our rule for actually designing this<br>[18:51] thing. This is so cool. I know people<br>[18:53] don't like it when designers do really<br>[18:55] hard stuff cuz like how am I going to<br>[18:56] implement it? But I love it because they<br>[18:59] are always coming up with neat ideas<br>[19:01] that I totally would not have thought of<br>[19:02] and like it's so fun to figure out how<br>[19:04] to make it work with CSS. So what do you<br>[19:07] think? Was that a decent implementation?<br>[19:09] How did I do time-wise? Leave in the<br>[19:11] comments. <!-- deep-read:sections end -->