Jhey ๐Ÿป๐Ÿ›  Profile picture
Jun 1 โ€ข 7 tweets โ€ข 3 min read
Oh, this? ๐Ÿ‘€

Jus' a pure CSS image zoom using CSS primitives ๐Ÿ”ฅ

โ€“ :has()
โ€“ object-view-box
โ€“ Houdini @ property

Code ๐Ÿ‘‡

img {
object-view-box: inset(var(--top) ...);
}

:root:has(#car:checked) {
--top: 61%;
...
}

Amazing ๐Ÿฅฒ

๐Ÿ‘‰ codepen.io/jh3y/pen/QWQrVโ€ฆ via @CodePen
Let's break down what's going on here ๐Ÿ˜Ž

I will not call this a thread...

The first property "object-view-box" allows us to apply an SVG like viewBox to an element such as an <img>. In this demo, I map the different "viewBox" to the different "Zoom" spots. img {   object-view-box: inset(     				var(--inset-top)
Next up, how do we change the zoom by hitting the radio buttons without JavaScript?

Well, let's introduce :has() (The parent selector) ๐Ÿš€

If we detect a certain radio button is :checked under :root, we can update the custom properties in :root ๐Ÿ”ฅ /* If default is :checked then set    no zoom */ :root:has(#
Last but not least, Houdini's "@ property" or the Properties and Values API ๐Ÿ’™

This allows us to animate and transition custom properties by providing context to the browser via types ๐Ÿค“ When the browser knows a type, it can transition things, like our inset values! ๐Ÿ’ซ /* length-percentage is the type*/ @property --inset-top {
Thanks for reading my spontaneous and random collection of tweets for a demo I spontaneously threw together quick in a moment of inspiration โœจ

Stay awesome y'all!

โœจ
ส• โ€ขแดฅโ€ขส”๏ผ
p.s In my excitement, I completely forgot to mention...

"Chrome Canary with Experimental Web Platform Features flag on" โ›ณ๏ธ๐Ÿฆ

It's late. I'm hungry. But, I'm also very excited about what amazing CSS things we're going to be cooking up! ๐Ÿ’™
p.p.s Get ready for "โšก๏ธ Speedy CSS Tips! โšก๏ธ" style content on this coming soon! ๐Ÿ‘€

โ€ข โ€ข โ€ข

Missing some Tweet in this thread? You can try to force a refresh
ใ€€

Keep Current with Jhey ๐Ÿป๐Ÿ› 

Jhey ๐Ÿป๐Ÿ›  Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @jh3yy

May 31
Pure CSS && SVG Tic Tac Toe! โšก๏ธ

You can build this without any JavaScript at all ๐Ÿซต๐Ÿ˜Ž

Went for a CyberPunk theme here, how would you style it? ๐ŸŽจ

Wanna learn how to make it? Course link is below! ๐Ÿ‘‡

๐Ÿ‘‰ codepen.io/jh3y/pen/KKNwpโ€ฆ via @CodePen
Learning with the "Impractically practical" โœจ

You'll pick up a bunch of CSS techniques you can use elsewhere ๐Ÿ’ช

Check out the "FREE" @eggheadio course โญ๏ธ

โ€“ Layout techniques
โ€“ Animating SVG
โ€“ "that" frosted effect
โ€“ And more!

egghead.io/courses/tic-taโ€ฆ
Got a bunch of CSS games on the way using the new CSS primitives and UI features coming down the pipeline โœจ

For example, :has and "popup" would be perfect here!
Read 4 tweets
Jan 14, 2021
Did you see @CodePen's "Most Hearted of 2020"? ๐Ÿ’•

Many awesome things on there! ๐Ÿ’ฏ

Honored to have not one, but four of my pens featured ๐ŸŽ‰ To see one of my whimsical creations in the top 5 is amazing ๐Ÿคฏ

Pens down below ๐Ÿ‘

๐Ÿ‘‰ codepen.io/2020/popular/pโ€ฆ
Big shout out to @CodePen ๐Ÿ™ It's a wonderful platform for sharing creative things and it's opened up a bunch of doors for me already.
"Newton's Light Bulbs" ๐Ÿ’ก

โš’๏ธ @greensock

codepen.io/jh3y/pen/abzeaโ€ฆ
Read 6 tweets
Oct 11, 2020
How to make single div(any element) CSS art - A mini thread ๐Ÿงต

Spoiler: No magic ๐Ÿช„ All that's required is patience and knowing your way around some properties ๐Ÿ‘

Let's gooo! ๐Ÿ‘‡

Starting with this timelapse โณ
The "Big" trick? Layered background images ๐Ÿ˜ฎ

With CSS you can give many backgrounds to an element. Comma separate background images and you're golden โœจ๐Ÿ†

What would this give for a 60px square? ๐Ÿค”

๐Ÿ‘‰ codepen.io/jh3y/pen/eYzNGโ€ฆ
It's common that you'll not repeat your background image layers.

Don't repeat yourself(DRY) and drop:

"background-repeat: no-repeat;"

Beneath your background declaration ๐Ÿ‘๐Ÿ˜Ž
Read 18 tweets
Jul 27, 2020
You want to create CSS illustrations? ๐Ÿ˜Ž

You can! ๐Ÿ’ช

There's no secret wizardry, I promise ๐Ÿง™โ€โ™‚๏ธ๐Ÿ™

What it takes:

โ€ข Time
โ€ข Patience
โ€ข Practice
โ€ข Planning
โ€ข Knowing your way around certain properties

Let's go through some of the stand out properties! ๐Ÿ‘‡๐Ÿค“

<๐Ÿงต>
Aside from being able to size an element, we need to know how to position it ๐Ÿ“

One trick is to give our element a random color and reduced opacity so we can see what we're doing! ๐Ÿ˜‰

css-tricks.com/almanac/properโ€ฆ
Once an element is in place, it needs the right shape ๐Ÿ‘

border-radius will aid you with creating complex curves ๐Ÿ’ช

egghead.io/lessons/css-usโ€ฆ
Read 11 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us on Twitter!

:(