Video wird geladen...

Video konnte nicht geladen werden

Zur Startseite

Future CSS Tip! 🔮 (This one's close 🤏) You can use "subgrid" to give child elements access to a parent's grid tracks 👀 This is great when you want to make sure content lines up 🙌 Check those cards 👇 article { grid-row: span 4; display: grid; grid-template-rows: subgrid;...

507,628 Aufrufe • vor 2 Jahren •via X (Twitter)

11 Kommentare

Profilbild von jhey ▲🐻🎈
jhey ▲🐻🎈vor 2 Jahren

Here's that @CodePen link! 🚀 Available in Firefox, Safari, and Chrome 117+ 🤙 Now go forth and show off your CSS Grid superpowers. Keen to see what people come up with. Found it tricky to find use cases when I presented this last year 🤓

Profilbild von Mohamed Ramadan
Mohamed Ramadanvor 2 Jahren

That is really very interseting trick! But lets wait untill it become fully supported ⚠️

Profilbild von jhey ▲🐻🎈
jhey ▲🐻🎈vor 2 Jahren

P.s I know these cards are ugly 😅

Profilbild von Simon Ramsay 🚀 🧞‍♂️ 𝕩
Simon Ramsay 🚀 🧞‍♂️ 𝕩vor 2 Jahren

Seem so simple. Does it automatically work out the best heights for each row?

Profilbild von jhey ▲🐻🎈
jhey ▲🐻🎈vor 2 Jahren

Yeah, the "magic" of implicit grid tracks at play there and working it out off the parent layout 😍 I had to present it at the back end of last year and was hunting around for ways to make use of it 😅

Profilbild von Estebandido
Estebandidovor 2 Jahren

@Alejo_Gamboa

Profilbild von EREIAMJH
EREIAMJHvor 2 Jahren

I *really* needed this a few months ago. Found subgrid, then cried when I saw the browser support. Ended up with Javascript workaround. Guess I'll revisit in a few months if it's imminent.

Profilbild von Pedro Filho
Pedro Filhovor 2 Jahren

This is one of the few use cases that I really use grid

Profilbild von jhey ▲🐻🎈
jhey ▲🐻🎈vor 2 Jahren

For cards? I find myself often jus' kinda fluidly switching between flex and grid as and when it feels right which is a weird thing to do I guess 😅

Profilbild von Morgan - Freelance frontend developer
Morgan - Freelance frontend developervor 2 Jahren

This is one of the use-cases for sub-grid Rachel Andrew wrote about yonks ago. It’s great.

Profilbild von jhey ▲🐻🎈
jhey ▲🐻🎈vor 2 Jahren

It's nice to finally see it coming into all the browsers. There was a little inconsistency still when I presented it last year. Looks like that is getting ironed out 🙌 Could you think of any other interesting layout use cases?

Ähnliche Videos

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,159 Aufrufe • vor 2 Jahren

As part of my assignment, I was tasked with designing a high-density data grid for an SEO platform. During development, our analysis of Google Analytics data revealed that the majority of our users access the platform on 13-inch display laptops. This insight necessitated optimizing the data grid for this screen size. A key challenge we encountered was the sidebar housing keyword filters, which occupied a significant portion of the available space. Since this feature was integral to the page, removing it was not an option. Even making it collapsible would have had minimal impact on the overall layout. Our initial approach involved implementing an inner horizontal scroll to accommodate additional columns. However, this solution introduced technical limitations due to the grid’s accordion UI pattern, which enables users to expand rows for detailed views. This functionality effectively split the table in half, making it difficult to synchronize scrolling across two separate grid sections within modern browsers. To address these constraints, I devised an alternative solution: implementing auto-expandable and collapsible columns based on content visibility. For instance, the "Flag" and "Performance" columns dynamically collapse by default and expand when hovered over, allowing users to access the necessary details when needed. This approach enabled us to fit all columns within a 13-inch display without relying on horizontal scrolling, ensuring a more efficient and user-friendly experience.

virgil pana

44,560 Aufrufe • vor 1 Jahr

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 Aufrufe • vor 2 Jahren

"[Trump] knows how dangerous [the mRNA technology] is. The facts are on the table...And...Bobby is going to do everything he can...[but] he's up against...the whole control grid...[and] mRNA technology is an integral part of implementing the control grid." Former Assistant Secretary of Housing and Urban Development, investment banker, and founder of the Solari Report Catherine Austin Fitts (The Solari Report | Catherine Austin Fitts) describes on a recent episode of the Children’s Health Defense series Financial Rebellion how President Trump knows how dangerous the mRNA injections are as "the facts are on the table." Fitts adds that while RFK Jr. will do "everything he can" to limit the damage done by the injections, "he's up against...the whole control grid" that is currently being ushered in and consists of things like digital IDs and controllable digital currencies. "If you look at the pressure that started in early 2020, building enormous momentum in the investment community for this technology and for the control grid, this is at the heart of building the Internet of bodies and using the AI to connect with humans and living things," Fitts says of the mRNA injections. "[T]hese guys have huge global investment all over the world since early 2020 betting on the digitization of everything in part using mRNA technology." Fitts goes on to say: "So this is far bigger and deeper. And I've seen them do a great deal to try and engineer modified hangouts to support mRNA technology. And we see the Trump administration, the president, two days, three days into the administration, right after the inauguration proposing Stargate with mRNA technology, selling it as if it's wonderful. He knows how dangerous it is. So the facts are on the table. And I think Bobby is going to do everything he can, but...you need to understand that this is a much broader, deeper [problem] and what he's up against is the whole control grid. In other words, mRNA technology is an integral part of implementing the control grid. It's not just a health thing. "We we can't put it on Bobby that he's gonna be the great man who rides in on the white horse and saves us. We need a concerted effort of millions of people off the couch saying, 'No way, Jose.' In every statehouse, across the government, getting the congressman [to act]...don't put this on one person. This has to be a hugely broad-based juggernaut."

Sense Receptor

39,993 Aufrufe • vor 1 Jahr