Loading video...

Video Failed to Load

Go Home

how do you get the size and position of an HTML element?

37,038 views • 1 year ago •via X (Twitter)

10 Comments

Tiger Abrodi's profile picture
Tiger Abrodi1 year ago

Nice. Performance stuff is really fun. One issue I had on my stock market explorer was that too many re-renders happened as data came in, especially during active hours. The goal there was to throttle and batch updates.

Jeff Rosen's profile picture
Jeff Rosen1 year ago

Absolutely love @pmndrs react-use-measure. Implemented in a performant way and very ergonomic.

S's profile picture
S1 year ago

Bro this is fire!!!!!!! You gotta post these in a blog or guide format. Thanks for sharing these good nuggets

Ozgur Ozer's profile picture
Ozgur Ozer1 year ago

I'm watching at 0.75x speed

Veronica Hines's profile picture
Veronica Hines1 year ago

Ask it nicely and hope for the best.

Thilak's profile picture
Thilak1 year ago

This is cool

Starprince⚡️'s profile picture
Starprince⚡️1 year ago

Lovely how this is presented.

Bernardo Quina's profile picture
Bernardo Quina1 year ago

Loving this videos. Keep them coming.

João Victor | Developer's profile picture
João Victor | Developer1 year ago

that’s truly useful

Pedro Batista's profile picture
Pedro Batista1 year ago

If only there was already a program who implemented positioning natively...

Related Videos

CSS Trick! 🤙 You can create gradient borders on translucent elements using mask-clip and mask-composite with a pseudo-element 🔥 .gradient-border::after { mask-clip: padding-box, border-box; mask-composite: intersect; mask: linear-gradient(transparent, transparent), linear-gradient(white, white); } It's the same "Transparent border trick" from before. But, now you apply it to a pseudo-element 😎 The trick is to create a pseudo-element with a gradient background and then mask it so we only see the part we want, the border ✨ mask-clip defines the area affected by a mask. Similar to how you can define background-size. Using padding-box and border-box constrains the two masks. mask-composite is the magic part ✨ It defines a compositing operation for stacked mask layers. Using intersect means that the parts that overlap get replaced. And this seems to work in all browsers 🙌 As for the rest of the styles... – Make sure you set pointer-events: none on the pseudo-element – Make sure it fills the parent element. You can use position: absolute and inset: 0 – Make sure the background fills the space including the border-width. You can use calc to achieve that: --bg-size: calc(100% + (2px * var(--border))); background: var(--gradient) center center / var(--bg-size) var(--bg-size); That's it! 🚀 Gradient borders on translucent elements. You can set all the backdrop-filter: blur() you like! 😅 CodePen.IO link below! 👇

jhey ʕ•ᴥ•ʔ

269,739 views • 2 years ago