𝙻𝚘𝚔𝚎𝚜𝚑 𝚁𝚊𝚓𝚎𝚗𝚍𝚛𝚊𝚗 (@lokesh_coder) header
𝙻𝚘𝚔𝚎𝚜𝚑 𝚁𝚊𝚓𝚎𝚗𝚍𝚛𝚊𝚗 (@lokesh_coder) profile picture

𝕏

Bengaluru, India
Joined July 2010
𝙻𝚘𝚔𝚎𝚜𝚑 𝚁𝚊𝚓𝚎𝚗𝚍𝚛𝚊𝚗 retweeted
2025 CSS Reset
2024 CSS Reset
43
246
11
3,056
543,741
𝙻𝚘𝚔𝚎𝚜𝚑 𝚁𝚊𝚓𝚎𝚗𝚍𝚛𝚊𝚗 retweeted
Replying to @nixcraft
If you're gonna run code from the internet you don't understand, maybe start with: docker run -it --rm alpine:latest sh and then run it ;-)
31
126
5
3,162
85,835
𝙻𝚘𝚔𝚎𝚜𝚑 𝚁𝚊𝚓𝚎𝚗𝚍𝚛𝚊𝚗 retweeted
I wanted to share the following 10 Tailwind techniques. These will come in handy next week. For those who don’t use Tailwind, here be dragons! 1/10 - Let’s start simple. Set a CSS variable (width) based on state and use an arbitrary className.
93
581
44
5,479
348,843
𝙻𝚘𝚔𝚎𝚜𝚑 𝚁𝚊𝚓𝚎𝚗𝚍𝚛𝚊𝚗 retweeted
Things I should have put in my .gitconfig years ago
112
639
37
9,598
916,499
𝙻𝚘𝚔𝚎𝚜𝚑 𝚁𝚊𝚓𝚎𝚗𝚍𝚛𝚊𝚗 retweeted
We didn't get into @ycombinator summer batch -- but we don't need them away 🥲 But here's our demo video -- enjoy ❤️ #investment #startup #storyboard #ux #buildinginpublic
66
35
10
532
57,826
𝙻𝚘𝚔𝚎𝚜𝚑 𝚁𝚊𝚓𝚎𝚗𝚍𝚛𝚊𝚗 retweeted
the little details™ Use trigonometric functions in CSS to create a smooth staggered transition delay 🎬 .character { transition-delay: calc(sin((var(--index) / 12) * 45deg) * 0.475s); }
Still can't believe this effect can be achieved by a single line of code. Mind blowing.
55
488
35
5,390
540,102
𝙻𝚘𝚔𝚎𝚜𝚑 𝚁𝚊𝚓𝚎𝚗𝚍𝚛𝚊𝚗 retweeted
CSS Tip! 🍬 You can create a CSS-only sticky CTA using position: sticky or scroll-driven animations 🤙 .cta { position: sticky; margin-top: 110vh; bottom: 2rem; /* 👈 Stick! */ } This is one way 👀 This first way relies on you setting a layout on the body and putting the CTA in a zero-space part of the layout body { display: grid; grid-template-columns: auto 0; } The children of the body are an element with your content and then the CTA. You could also use display:flex too. .content { flex: 1 0 100%; } .cta { place-self: end; } As you scroll the body, the CTA comes into view and sticks in position 🙌 That's one way. If you want to take it further and do something like flip between showing or not, maybe scale it up, or add some special easing, etc. an animation is another way 📜 First, change the styles for your CTA. Note the translate property that's powered by a custom property .cta { position: fixed; bottom: 2rem; right: 2rem; translate: 0 calc(20vh - (var(--show) * 20vh)); transition: translate 0.875s var(--elastic); } Next you need a custom property that you're going to animate @​property --show { inherits: true; initial-value: 0; syntax: '<number>'; } Lastly, you animate this value on the body. As the property value changes, the value will trickle down to the CTA @​supports (animation-timeline: scroll()) { body { animation: show-cta both steps(1); animation-timeline: scroll(root); animation-range: 0 10vh; } @​keyframes show-cta { to { --show: 1; } } } Using @​supports you can use this as a progressive enhancement. If scroll-driven animations are supported, use them. Otherwise fallback to using position: sticky 🤙 That's it! As always, any questions or requests, hit me up! 🙏 @CodePen link below! 👇
Summoning the CSS wizard @jh3yy 🧙 How would you do that sticky button CTA without JavaScript 👀
13
78
4
818
133,190
𝙻𝚘𝚔𝚎𝚜𝚑 𝚁𝚊𝚓𝚎𝚗𝚍𝚛𝚊𝚗 retweeted
🎉 All major browsers now support the new Array.prototype.with method 🥳 developer.mozilla.org/en-US/… Ideal for immutable updates. Here is an example with Angular signals:
4
29
142
8,622
𝙻𝚘𝚔𝚎𝚜𝚑 𝚁𝚊𝚓𝚎𝚗𝚍𝚛𝚊𝚗 retweeted
Introducing the Bun Shell Cross-platform shell language & interpreter for shell scripting with JavaScript
152
409
246
3,655
993,978
𝙻𝚘𝚔𝚎𝚜𝚑 𝚁𝚊𝚓𝚎𝚗𝚍𝚛𝚊𝚗 retweeted
What if the scrollbar went around the corner? 👀 CSS could do that ✨
A scroll indicator that wraps around a rounded corner by @RoberaGeleta
109
529
64
6,237
847,308
𝙻𝚘𝚔𝚎𝚜𝚑 𝚁𝚊𝚓𝚎𝚗𝚍𝚛𝚊𝚗 retweeted
Cool demo of what PWAs can do today: whatpwacando.today This site can be installed as a PWA and you can try all these features on your phone.
51
158
17
1,049
152,312
𝙻𝚘𝚔𝚎𝚜𝚑 𝚁𝚊𝚓𝚎𝚗𝚍𝚛𝚊𝚗 retweeted
We all know the HTML <input> tag but I was today years old when I learned about <output>
19
31
6
537
80,543
𝙻𝚘𝚔𝚎𝚜𝚑 𝚁𝚊𝚓𝚎𝚗𝚍𝚛𝚊𝚗 retweeted
How much of this math do you know? A clever animation vs math by Alan Becker [full video: buff.ly/44cL72j] teapawt.net/Levandov_2/status/1708…
151
4,006
330
18,518
2,807,430
𝙻𝚘𝚔𝚎𝚜𝚑 𝚁𝚊𝚓𝚎𝚗𝚍𝚛𝚊𝚗 retweeted
Coding be like...
4
7
45
3,061
𝙻𝚘𝚔𝚎𝚜𝚑 𝚁𝚊𝚓𝚎𝚗𝚍𝚛𝚊𝚗 retweeted
Another one, very subtle this time: { 0% { mask: linear-gradient(90deg, #000 25%, #000000e6 50%, #00000000) 150% 0 / 400% no-repeat; opacity: .2; } 100% { mask: linear-gradient(90deg, #000 25%, #000000e6 50%, #00000000) 0 / 400% no-repeat; opacity: 1; } }
28
217
6
2,602
𝙻𝚘𝚔𝚎𝚜𝚑 𝚁𝚊𝚓𝚎𝚗𝚍𝚛𝚊𝚗 retweeted
Your icons should be SVG sprites instead of JSX - make a component like <Icon name="trash" /> - get autocomplete for icon names - auto build the spritesheet when new svgs are added jacobparis.com/content/svg-i…
18
55
2
510
89,287
𝙻𝚘𝚔𝚎𝚜𝚑 𝚁𝚊𝚓𝚎𝚗𝚍𝚛𝚊𝚗 retweeted
🎨 CSS tip(3): `height: 100vh` is a common way to make your app fit the whole window. It won't do a good job on mobile though 😬 `height: 100dvh` works way better! 📱 See the difference on your phone: dvh.stackblitz.io 💻 Play with the demo: stackblitz.com/edit/dvh?file…
37
436
22
2,370
277,000
𝙻𝚘𝚔𝚎𝚜𝚑 𝚁𝚊𝚓𝚎𝚗𝚍𝚛𝚊𝚗 retweeted
I was unaware of `text-wrap: pretty;` I knew about the (new/cool) `text-wrap: balance;` — but sometimes that's a bit... too much. I feel like it's nice on headers but not smaller type. Here's what I mean.
19
151
20
1,396
393,963