Berat (@BeratSdev) header
Berat (@BeratSdev) profile picture

I love building beautiful things, and help each other. #Svelte #React #Solid #Qwik #Vue #Angular, #Typescript, #Flutter, #Dart, #Node, #Next.js #Nest.js #Node

Former Yugoslav Republic of Ma
Joined May 2014
Photo by Berat (@BeratSdev)Photo by Berat (@BeratSdev)Photo by Berat (@BeratSdev)Photo by Berat (@BeratSdev)Photo by Berat (@BeratSdev)Photo by Berat (@BeratSdev)Photo by Berat (@BeratSdev)Photo by Berat (@BeratSdev)
🚀 Agentic AI is moving beyond experimentation and into real business operations. How organizations can automate workflows, improve decision-making, strengthen governance, and create measurable business value with AI. alphaconsultancy.ai/insights…
1
1
10
table of contents marker w/ modern css 🧑‍🍳 .toc { scroll-target-group: auto; } a:target-current { anchor-name: --active; } .toc::after { position-anchor: --active; top: anchor(top); } fun progressive enhancement, no js 🤙
Day 15 of building cool ideas I love 🚀 Been super occupied, but I had some time to work on this blog post animation using CSS and JS I am curious @jh3yy if this can be done with only css
32
173
6
3,029
178,655
Berat retweeted
Use the standard Node.js "imports" field instead of TypeScript aliases:
49
82
24
1,337
97,655
how you take an image list and turn it into a 3D scroll-driven carousel with CSS 🤙
24
55
7
1,155
58,143
🚫 𝗔𝘃𝗼𝗶𝗱 Using a full context value in every component can trigger unnecessary re-renders. ✅ 𝗜𝗻𝘀𝘁𝗲𝗮𝗱 Use 𝘤𝘰𝘯𝘵𝘦𝘹𝘵 𝘴𝘦𝘭𝘦𝘤𝘵𝘰𝘳𝘴 to pull only the data you need. This reduces re-renders and improves performance.
10
52
665
53,073
<table> highlighting with CSS :has() 💡 td:has(~ td:hover), /* previous sibling cells */ table:has(td:nth-of-type(3):hover) /* column cells */ tr:not(:first-of-type):has(~ tr:hover) td:nth-of-type(3) { background: var(--highlighted); }
83
430
23
5,564
503,280
Updating the "inverted radius" shape to add two more variables to control the offset of inner curve. css-shape.com/inverted-radiu…
3
46
5
445
23,273
attr() is getting an upgrade! Starting in Chrome 133 (stable rollout happening this month), you'll be able to access attributes in CSS as typed values beyond strings. Here's an example of where that's pretty cool. Given: <div data-rating="4.5"> You can use data-rating as a numerical value with: attr(data-rating type(<number>) So in this demo, I'm using that value to show a fill percentage in the stars (as a background gradient with a mask). I'm also able to use this value as a string (which was possible before) to represent its content as a string in a pseudo element. Two for one!
7
61
10
477
38,245
extra detail: animate a CSS custom property from 0 to 100 on scroll and use that for a counter() label::after { content: counter(complete) '% complete'; } translate the label using container query units ✨ translate: 0 calc(var(--p) * 1cqh);
responsive animated stroke text with CSS 🤌 use scroll animation combined with -webkit-text-stroke and background-clip: text change the content and the animation adapts!
3
46
1,059
78,680
An example of responsive, interruptible, draggable and auto-animated infinite carousel with the new anime.js v4 `createDraggable()` API.
9
47
3
808
51,078
Use CSS custom properties and the sin() trigonometric function to give each character an eased animation-delay 🤙 .char { animation-delay: calc( sin((var(--index) / var(--total)) * 90deg) * var(--duration) ); }
This post is from an account that no longer exists. Learn more
26
216
10
2,537
281,426
PREVIOUSLY: separate rulesets for light and dark NOW: one ruleset with `light-dark()`
New article got published: CSS `color-scheme`-dependent colors with `light-dark()` 🔗 web.dev/articles/light-dark
18
267
19
2,006
269,975
We're excited to have @DrizzleORM as the first ORM to support PGlite 🎉🚀 • Run full Postgres embedded in your app with PGlite. • At only 2.6mb, it's perfect for local-first apps! github.com/electric-sql/pgli… github.com/drizzle-team/driz…
13
25
5
267
31,734
Very cool and interactive blog post about micro-optimization with JavaScript, by romgrk romgrk.com/posts/optimizing-…
6
55
5
310
33,957
✨ Tailwind CSS v4 demo ✨ Define **one** CSS variable in CSS and generate a comprehensive set of utilities to use the "design token" in your project. Colors for text, background, border, caret, shadow, gradient-from, via, to, etc 💥 Tailwind is a CSS framework... generator 🪄
15
55
5
596
42,891
The untold history of web development: 1990: HTML invented 1994: CSS invented to fix HTML 1995: JS invented to fix HTML/CSS 2006: jQuery invented to fix JS 2010: AngularJS invented to fix jQuery 2013: React invented to fix AngularJS 2014: Vue invented to fix React & Angular 2016: Angular 2 invented to fix AngularJS & React 2019: Svelte 3 invented to fix React, Angular, Vue 2019: React hooks invented to fix React 2020: Vue 3 invented to fix React hooks 2020: Solid invented to fix React, Angular, Svelte, Vue 2020: HTMX 1.0 invented to fix React, Angular, Svelte, Vue, Solid 2021: React suspense invented to fix React, again 2023: Svelte Runes invented to fix Svelte 2024: jQuery still used on 75% of websites
406
2,088
303
12,722
1,524,740
CSS Trick! ⚡️ You can use scroll-driven animation with background-attachment to create a dynamic glowing card scroller without JS 🔥 section { animation:vibe; animation-timeline:--list; } @​keyframes vibe { to{--hue:320;}} .glow {background: hsl(var(--hue) 80% 50%);} Here's how! 🤙 You can use the background-attachment trick used in other glow card demos 😎 article { background-attachment: fixed; } The difference here is that you aren't going to update the fixed background position with your pointer this time. It can remain fixed. The magic part is that as you scroll, the background will leave the card that's leaving and enter the card that's entering ✨ For the extra background glow, you can use a fixed pseudo element on the list container itself 💪 Once that's in place, you're only task is to change the color of the background as you scroll 🤔 Create a custom property declaration for the --hue @​property --base { inherits: true; syntax: '<number>'; initial-value: 0; } Then create an animation that updates this value @​keyframes accent { to { --hue: 320; }} The last piece is hooking it up to scroll and there is a little trick in here 👀 First, you need an inline scroll-timeline on the list ul { scroll-timeline: --list inline; } Then you can use timeline-scope to hoist that scroll-timeline up so a parent can use it. You then animate the custom property on this element and let the value cascade down to the places that need it 🔥 section { timeline-scope: --list; animation: accent both linear; animation-timeline: --list; } For example, the glow uses the --hue this way [data-glow] { background-image: radial-gradient( 150px 150px at 50% 50%, hsl(var(--hue) 100% 70% / 0.25), transparent ); } Lastly, scroll-snap is optional of course but plays nice with the scroll-driven animation demos ✨ The key for that is ul { scroll-snap-type: x mandatory; } li { scroll-snap-align: center; } That's it! Pretty fun trick to play with! 🤓 Any questions, let me know! Should we add it to the video walkthrough list? @CodePen link below! 👇
4
137
4
984
116,871
Couldn't resist 😁 You can use some JavaScript <canvas> trickery to create a responsive clipped text effect ✨ context.drawImage(text, 0, 0) context.globalCompositeOperation = "source-in" context.drawImage(rings, 0, 0) Use compositing to clip the animated rings to text 🤓 – Statically write the text to an offscreen canvas – Animate the rings on an offscreen canvas – Render them to the canvas in the DOM with compositing ⚡️ @CodePen link below! 👇
15
111
2
1,072
175,024
UI && CSS Tip! 🔥 You can create these dynamic glowing card effects with a single JavaScript event listener, some CSS tricks, and an HTML attribute 🤙 <article data-glow /> Here's how! 👇 You can use a combination of tricks from previous posts. Let's start with the JavaScript 📜 Use a function like this to send the pointer position via custom properties to the glows ✨ Attach this to the pointermove event 👆 const onPointermove = ({ x, y }) => { document​.documentElemen​t​.style.setProperty('--x', x) document.documentElement​.style.setProperty('--xp', x / innerWidth) document.documentElement​.style.setProperty('--y', y) document.documentElement​.style.setProperty('--yp', y / innerHeight) } Now for the styles 🎨 These custom properties define the border and spotlight size. The first trick is how you can change the color(--hue) based on the pointer position with calc 😎 [data-glow] { --border-size: 2px; --spotlight-size: 150px; --hue: calc(var(--base) + (var(--xp) * var(--spread))); } The magic is using the pointer position in a radial-gradient combined with background-attachment: fixed ✨ (Check the video for an exploding view 🎞️) [data-glow] { background-image: radial-gradient( var(--spotlight-size) var(--spotlight-size) at calc(var(--x, 0) * 1px) calc(var(--y, 0) * 1px), hsl(var(--hue) 100% 70% / 0.25), transparent ); background-attachment: fixed; } The last major piece is using mask-composite on the pseudoelements of the [data-glow] element and the same background-attachment: fixed trick 🫶 [data-glow]::before, [data-glow]::after { pointer-events: none; content: ""; position: absolute; inset: calc(var(--border-size) * -1); border: var(--border-size) solid transparent; background-attachment: fixed; background-size: calc(100% + (2 * var(--border-size))); background-position: 50% 50%; mask: linear-gradient(transparent, transparent), linear-gradient(white, white); mask-clip: padding-box, border-box; mask-composite: intersect; } This masks the elements so only a fake border is shown. That border is actually the spotlight background that moves around 👀 But now it's clipped to the border width 😎 Then it's a case of switching out the background-image for each pseudoelement based on purpose 🧐 For example, to get the white light, use your custom properties, make the light a little smaller and the color bright! [data-glow]::after { background-image: radial-gradient( calc(var(--spotlight-size) * 0.5) calc(var(--spotlight-size) * 0.5) at calc(var(--x, 0) * 1px) calc(var(--y, 0) * 1px), hsl(0 100% 100% / 1), transparent ); } These are the major pieces you need to get it done. Extras? Want the outer glow? Nest a glow! <article data-glow> <span data-glow /> </article> Give the inner glow a blur to create the outer glow 😅 [data-glow] > [data-glow] { filter: blur(10px); } It's worth digging in with this one. Have a play around with the demo and the custom properties. The code isn't perfect after introducing all the configuration pieces 😅 Will put together a reduced example for you! 🙏 Any questions, let me know! 💙 @CodePen link below! 👇
– One HTML attribute – One JavaScript event listener – Configurable via CSS custom properties Let's get this explodin' 🤙
21
130
4
1,304
382,616
Just on time to celebrate reaching 50 monthly @GitHub sponsors: 🚀Introducing draggables to anime.js V4! ✅ Inertia with spring animation ✅ Snap to grid ✅ Axis lock ✅ Container autoscroll ✅ Transformed container ✅ Quick swipe gestures ✅ onSnap callback And a lot more...
18
83
6
1,008
91,142