CSS Transform Is Dead! Use This Instead

  Рет қаралды 117,622

Web Dev Simplified

Web Dev Simplified

Күн бұрын

CSS is adding lots of new features and some of the smaller quality of life features they added recently were the addition of the translate, rotate, and scale properties. These properties almost entirely remove the need to use the transform property which is incredibly nice since there are tons possibilities this opens up that were very difficult if not impossible before.
🌎 Find Me Here:
My Blog: blog.webdevsimplified.com
My Courses: courses.webdevsimplified.com
Patreon: / webdevsimplified
Twitter: / devsimplified
Discord: / discord
GitHub: github.com/WebDevSimplified
CodePen: codepen.io/WebDevSimplified
⏱️ Timestamps:
00:00 - Introduction
01:45 - Scale
02:17 - Translate
02:48 - Rotate
04:02 - Example 1
05:10 - Example 2
#CSSTransform #WDS #CSS

Пікірлер: 234
@IZR194
@IZR194 Жыл бұрын
Getting to use that in projects 3-5 years from now will be amazing.
@wallacesantos0
@wallacesantos0 Жыл бұрын
CSS used to be like this when we used to care about IE. Nowadays the majority of browsers are Chromium, and the ones that aren't also implements the features pretty quickly. So it won't be that long until 95%+ coverage
@IZR194
@IZR194 Жыл бұрын
@@wallacesantos0 all good, unless you plan to support iPhones. IE didn't go anywhere, nowadays we just call it Safari.
@trappedcat3615
@trappedcat3615 Жыл бұрын
@@wallacesantos0 It's not just IE. There are many user who simply don't or can't update their browsers. Chrome OS devices stop updating Chrome at certain point and those users are stuck on an older version. Each model has an end of life cycle where updates just cease. Android models also have a limit on what versions of Chrome and Firefox are supported.
@ashwinbhargava3011
@ashwinbhargava3011 Жыл бұрын
Time to write a webpack loader then.
@mansch55
@mansch55 Жыл бұрын
@@IZR194 iOS supports this since version 14.1
@jfftck
@jfftck Жыл бұрын
The biggest difference between these properties and the transform property is that the transform each function is applied in order where it is easier to work with 3D transformations as you can rotate after translate or the other way around. But this will be useful for most use cases.
@IdleAtre
@IdleAtre Жыл бұрын
i still use transform because you can actually use both transform: translate and the standalone translate, and they overlap without overriding, which allows you to define an x translate and later work on the y without having the need to reference the x once again, this makes things way more convenient. if you do transform: translateY(-50%); and in another class selector translate: -100% 0; both horizontal and vertical translates will be effective, if you only use one of those, then you will have to know the x and y translate every time. This basically works as an offset translate.
@chinhtrung6130
@chinhtrung6130 Жыл бұрын
I agree with your opinion, we should use the old transform for translate property and use standalone properties for the other to avoid any conflict if we were using any CSS Framework.
@degenyakuza
@degenyakuza Жыл бұрын
@@chinhtrung6130 agree
@advaittrivedi5905
@advaittrivedi5905 Жыл бұрын
Actually your videos are so much fun to watch it's like getting entertainment and information at the same time... Great job Kyle... 🙌🏻🙌🏻🤩
@Mazoane
@Mazoane Жыл бұрын
This is amazing. I was struggling to create a slime that has some animations on my portfolio and, since new transform properties overwrite preexistentes ones, I had to limit my slime’s animation. With the these new features, I can go back and implement what I wanted. I didn’t know you could fix that issue with css variables
@ascourter
@ascourter Жыл бұрын
Great video. To the point and really good examples. Was able to watch this and now can use scale, rotate, translate. Thanks!
@boiimcfacto2364
@boiimcfacto2364 Жыл бұрын
Kyle my man, your content is already super interesting. The title of this video is unnecessary clickbait in my opinion. New web devs: this is a VERY new feature in CSS so it won't support a vast majority of browsers. It's great for small personal projects, but don't go using these for around 3-4 more years in enterprise production code. Love your content as always - though maybe lay off the clickbait a little?
@NoeruCranel
@NoeruCranel Жыл бұрын
From caniuse, the properties are at about 80% coverage for the userbase. If you look at the title from a biased personal opinion, it makes sense - I too would rather use these new props instead of transform, even more in combination with animations. So from a objective point of view, the title is clickbait, transform is not going to be replaced entirely. From a subjective pov it's understandable and fine imo.
@boiimcfacto2364
@boiimcfacto2364 Жыл бұрын
@@NoeruCranel Of course it's understandable from a subjective POV: that's what the 'subjective' part of it is there for. But even caniuse won't give you proper estimates. If you're not in the US or want your site to be accessible to the general public - then you've gotta account for the vast number of budget phones that aren't updated regularly. I'm from India, which means I have to assume 99% of my users will have the equivalent of an iPhone 6 XD
@ShawnRitch
@ShawnRitch Жыл бұрын
I agree, be straight up with the titling and descriptions of videos. I hate clickbait cr*p.
@NECOdes
@NECOdes Жыл бұрын
having clickbait doesn't change the content of the video tho, it's just there to attract more attention and play with KZbin algorithm
@rea1m_
@rea1m_ Жыл бұрын
@@NoeruCranel 80% is still insufficient amount tho
@ventsislavstoimenov4404
@ventsislavstoimenov4404 Жыл бұрын
Great video as usual 👌 Thank you, Kyle! Will it work also for styled components?
@rfryanfavour4369
@rfryanfavour4369 Жыл бұрын
You said I'm not gonna use the rotate 3d stuff but that was actually exactly what I needed to for my current css project .... thank you sir
@perrosaurio725
@perrosaurio725 Жыл бұрын
You make css so easy. Dude, awesome explanations. Do you have a video about rems vs pixels or something like that? I had some troubles with that in an interview so Im studying it again now.
@colettemr
@colettemr Жыл бұрын
Mind blown. I use the transform property a lot, especially on .svg. I've decided to put in a warning to only use updated browsers. People actually still use IE.. not Edge but IE. WHY???
@brhh
@brhh Жыл бұрын
I will never believe the people that would find my projects would be using ie, this browser is digita hazard. just the idea of using ie gives me headaches
@RootsterAnon
@RootsterAnon Жыл бұрын
not anymore my friend.. :D
@yestermonth
@yestermonth Жыл бұрын
Still popular in Japan
@theodorealenas3171
@theodorealenas3171 Жыл бұрын
@@yestermonth wait what?
@yestermonth
@yestermonth Жыл бұрын
@@theodorealenas3171 Yeah, a lot of Japanese institution still heavily rely on IE, part of the reason why Microsoft haven't fully phased it out.
@joerivde
@joerivde Жыл бұрын
Really love this, but mainly for transitioning, animating properties separately. Last example is perfectly possible by using the old transform as well though. Biggest concern I have: how do you specify the order of transformations?
@mr.doubled4766
@mr.doubled4766 Жыл бұрын
I got say man this really makes web development simplified 😇
@advaittrivedi5905
@advaittrivedi5905 Жыл бұрын
Also want a seperate video of you playing that awesome guitar at the back 😂🤣 it's been with us in our entire journey
@danielrondongarcia9905
@danielrondongarcia9905 Жыл бұрын
Great!! Thanks for sharing your knowledge!
@alperemir5529
@alperemir5529 Жыл бұрын
This is a great feature for who always writing " translate: transform(); " every time ! :D
@Technoph1le
@Technoph1le Жыл бұрын
ohh yeah. that happens to me as well
@Anonymous-il1fn
@Anonymous-il1fn Жыл бұрын
You got it backwards
@KalenMaahs
@KalenMaahs Жыл бұрын
That cleaned my animations a lot, thanks. Still have the chrome, machine specific, artifacting happening but I'm going to call 1 out of 5 test machine not something to worry about.
@sanatkumar7848
@sanatkumar7848 Жыл бұрын
Hi Kyle. Can you please mention the sites where you read about front-end development things
@ziweiwang3311
@ziweiwang3311 Жыл бұрын
hey guys, before you use this new feature, make sure to check its compatibility with the browsers on caniuse or MDN.
@jensgur
@jensgur Жыл бұрын
Yeah there are do many great properties we can't use because companies still using old browser versions:(
@andrewilliams4500
@andrewilliams4500 Жыл бұрын
Hey, I was just wondering about this, do you know what Browsers are compatible with this? I'd really appreciate it, because can't find anything that says what Browsers are compatible?
@bloodylupin
@bloodylupin Жыл бұрын
That's a game changer, thanks for the info 💎
@travisv
@travisv Жыл бұрын
Do you still need to use transform-origin or how do you change that value for the new individual properties?
@itsmaxim01
@itsmaxim01 Жыл бұрын
softs it was really confusing but thanks to you I've gotten more professional at it!! ✌
@iam-mehrab
@iam-mehrab Жыл бұрын
He is sitting there to save your time, make you smile while staring at your code running in awesome way.
@Yous0147
@Yous0147 Жыл бұрын
This is amazing, exactly the thing I was fighting against not too long ago. Is there a way to "polyfill" this into older browsers? I read someone talking about a web pack.
@CodeWithSahand
@CodeWithSahand Жыл бұрын
useful and well explained, thanks
@khaledbudajaja6137
@khaledbudajaja6137 Жыл бұрын
Thanks for sharing Does the new Scale and translate work inside bootstrap card class? The old ones have issue when element is placed inside bootstrap card class Thanks again
@gauravvishwakarma8111
@gauravvishwakarma8111 Жыл бұрын
Congratulations for 1million subscribers... 👍👍👍👍 Love from India 💓💓
@LePhenixGD
@LePhenixGD Жыл бұрын
Thank you very much! Though I do have a question regarding the *order* of these properties For instance if you apply this to a : transform: translate(-50%, -50%) scale(105%); It wouldn't give the same result as: transform: scale(105%) translate(-50%, -50%) So does the same rule apply with these newly added CSS properties?
@CottidaeSEA
@CottidaeSEA Жыл бұрын
My best suggestion is to simply try it. Also kind of strange that those two have different results.
@MartynDunnMusic
@MartynDunnMusic Жыл бұрын
@@CottidaeSEA They're different, because the translate is dependent on the size of the object. It moves by 50% of its size, so if the size increases the distance will, too. But not if the size is increased after the movement.
@CottidaeSEA
@CottidaeSEA Жыл бұрын
@@MartynDunnMusic Yeah, but since it's the same transform, I'd expect it to have a priority system rather than just going left to right.
@salmanhossain1637
@salmanhossain1637 Жыл бұрын
Thanks for the information
@webdev___bappa4289
@webdev___bappa4289 Жыл бұрын
Great. Informative video.
@aravindprabha4656
@aravindprabha4656 Жыл бұрын
Super 👌 bro clear cut explanation
@bobdinitto
@bobdinitto Жыл бұрын
Nice! Thanks for sharing!
@mujibulhaquetanim
@mujibulhaquetanim Жыл бұрын
please make videos on new css/Javascript features regularly
@truthteachers
@truthteachers Жыл бұрын
Hi bro, this is quite dangerous at this moment as the latest browers are screwed-up. After defining a series of transformation on a class, e.g. ".box {}" and the ".box::before", if then if i did a hover on the ".box" class, the hover effect happens not the original class but on class after all the transform have taken effect. Using transform and direct transformation properties has very significant different reactions which could mess up the page. I would send you the code you so could test but how do i do that...?
@thecodingchef9292
@thecodingchef9292 Жыл бұрын
Why do i have a feeling you actually suggested these changes to the css team, this really simpifies our lives, webdev indeed simpified
@connect_to_the_dots
@connect_to_the_dots Жыл бұрын
Oh, I goodly want to hear so!
@StrayKev
@StrayKev Жыл бұрын
Thanks for the video! This is a game changer
@ggorg0
@ggorg0 Жыл бұрын
That is the solution to a really big problem i had with my website. I needed to center a box on the screen (using translate -50% YES I KNOW FLEXBOX IS BETTER BUT I COULDNT USE IT BECAUSE OF OTHER STUFF) and also make it bigger on hover. I wrapped all that in a transition and... it transitioned the translate too. Thats a really big thing for me! Thanks soo much wds!
@Rust_Rust_Rust
@Rust_Rust_Rust Жыл бұрын
Just use flexbox
@ggorg0
@ggorg0 Жыл бұрын
@@Rust_Rust_Rust just read
@Rust_Rust_Rust
@Rust_Rust_Rust Жыл бұрын
@@ggorg0 just use margin: auto
@davydo7566
@davydo7566 Жыл бұрын
I recently just learnt abt perspective cos I had to make a transform card.. comes in handy
@gabrielalves8643
@gabrielalves8643 Жыл бұрын
Amazing. Thanks you man!
@ospha1
@ospha1 Жыл бұрын
Love your tutorials. Can you show how to work ssl into express server to use https?
@Sacramentix
@Sacramentix Жыл бұрын
We could solve the example 2 before but It's a pain. You basically need a wrapper for each animated transform property you and it become tricky with 3d perspective
@gametroll6311
@gametroll6311 Жыл бұрын
The problem with adopting new CSS changes is browser compatibility. Wouldn't you need to update to a new browser version that supports these new CSS properties? Not everyone updates their browser every time a new version comes out or every time CSS gets a change and update, so I'm a bit hesitant on adopting this at the moment.
@abdoellhathiev9062
@abdoellhathiev9062 Жыл бұрын
nice info, thanks kyle
@thekitspecial
@thekitspecial Жыл бұрын
do new properties mess up z-index stacking like transform does?
@MrKorintos
@MrKorintos Жыл бұрын
How could I substitute something like transform: rotate(45deg); transform-origin: 0 0 with this separate rotate property?
@QwDragon
@QwDragon Жыл бұрын
First of all you can animate css variables (have to use CSS.registerProperty or @property). And the secons thing: in transform the order of translate and scale matters. How is it solved with new properties? And how do they interact with transform itself if I use all 4 of them?
@williamcozzapereira8886
@williamcozzapereira8886 Жыл бұрын
Thank you very much man
@callMeMahfuz
@callMeMahfuz Жыл бұрын
Thanks for latest information
@Chalisque
@Chalisque Жыл бұрын
The transform is more powerful. The individual translate, rotate, scale simply optimise a common case. With transform you have full control over the transform matrix. If _all_ you want to do can be accomplished by scale, or rotate, or translate, then fine. But note that with translate you can specify the order in which the transforms are applied. And you can apply transforms multiple times. For example: dialog.b { transform: translate(-100px) rotate(45deg) translate(100px) rotate(-45deg); } dialog.c { transform: rotate(45deg) translate(-100px) rotate(-45deg) translate(100px); } These end up with the dialog not begin rotated, merely translated. Where it ends up is different for each, since rotation and translation do not commute. And if you translate before scaling vs afterwards (can't remember which way round it is as I write this), then the translation is scaled too. One way around, a 100px translate and a 2x scale will result in the element being twice as large but translated 100px; the other way around it will be 2x scaled but translated 200px. This all goes back to the venerable days of the Postscript imaging model, which is the granddaddy of modern 2D drawing APIs.
@sabuein
@sabuein Жыл бұрын
As always, thank you, Kyle.
@Karthik-ug8ll
@Karthik-ug8ll Жыл бұрын
Hey kyle,thanks for awesome videos.can you please make video on bundling react project with webpack.this is my humble request.i didnt find single video on bundling of create react app project with webpack 5 or 4.
@markopolo2224
@markopolo2224 Жыл бұрын
can you make a video about how to apply animation like fading in for example for a div only when it appears on screen and for it to also fade out when scrolled past it? i been trying to find a way but so far it only works in one way and not the other thanks.
@ontheruntonowhere
@ontheruntonowhere Жыл бұрын
You can't do it with CSS alone, but it's easy with a little javascript. Check out intersection observer: kzbin.info/www/bejne/aHrFg6egmt9pl8k
@SirChogyal
@SirChogyal Жыл бұрын
Rotation is cool. I like it. Now I am using it.
@dave6012
@dave6012 Жыл бұрын
What about transform origin? Is there an equivalent for these properties?
@multiwebinc
@multiwebinc Жыл бұрын
Hey Kyle. I've noticed in several of your videos that you blink excessively. I used to have the same problem and it turns out it was very dry eyes, but unfortunately I let it go for too long and ended up giving myself astigmatism. I was able to fix my dry eyes by taking Omega 3 supplements and moisturizing eye drops when they get really bad. Maybe you should try that out before you end up with astigmatism.
@ChrisMochinskiMusic
@ChrisMochinskiMusic Жыл бұрын
I have this issue - it’s a minor OCD thing (I also obsessively clear my throat).
@youcube291
@youcube291 Жыл бұрын
Thanks for information
@meganweber5057
@meganweber5057 Жыл бұрын
This is so great. I hope we get parent-relative units soon.
@Take-the-Ticket
@Take-the-Ticket Жыл бұрын
Soon! :has is coming. Ex. div:has(p) will select any div with a paragraph in it. Firefox and abunch of mobile browsers are the hold-outs right now.
@thelastninja4825
@thelastninja4825 Жыл бұрын
finally ! no need to keep the state with multiple transform elements, thank
@clarkdnro
@clarkdnro Жыл бұрын
very nice dude but how much memory eats a rotating box ?
@dmitryutkin9864
@dmitryutkin9864 Жыл бұрын
What about transform-origin? Is it applicable to new props?
@Lee-zh2mc
@Lee-zh2mc Жыл бұрын
arrow forward once to get "Analog app 1 TE" like he uses in the video or simply find one you'd like to use alternatively instead.
@yusufsaify6735
@yusufsaify6735 Жыл бұрын
Awesome man great👍🏻
@andrewilliams4500
@andrewilliams4500 Жыл бұрын
Is it supported by all Browsers ? Can't seem to find any info on that? Especially wondering about Chrome, Firefox and Safari?
@midnightinsane6893
@midnightinsane6893 Жыл бұрын
This is very convenient, but it will not work when combined. like in the cursor cursor and other components. But it can be solved with calc.
@sobanya_228
@sobanya_228 Жыл бұрын
Wow, Safarie 14 supports this and I've never even heard about it
@jenstornell
@jenstornell Жыл бұрын
I think example two could be solved by specifying that the rotate custom property is a number. Look at Lea Verous videos.
@theohallenius8882
@theohallenius8882 Жыл бұрын
Last time I used scale() it messed up everything inside the html tag and made text selection not possible, so I will stick to transform: scale .
@vasyaqwe2087
@vasyaqwe2087 Жыл бұрын
Can anybody share a link where I can look at the browsers compatibility?
@mohamedyoussef8835
@mohamedyoussef8835 Жыл бұрын
Awesome info 😃😃
@atg878
@atg878 2 ай бұрын
how i can make transform: rotatex(20deg) rotate(30deg) by the new css feature
@salmanhossain1637
@salmanhossain1637 Жыл бұрын
Finally, it came 🤗🤗🤗
@ChrisMochinskiMusic
@ChrisMochinskiMusic Жыл бұрын
I’m seeing minimal documentation and no support (yet) other than Firefox. 1. Anyone know when exactly these properties dropped? 2. Anyone able to track down solid docs?
@michelaveline
@michelaveline Жыл бұрын
Always good news!
@AkashYadav-pq6de
@AkashYadav-pq6de Жыл бұрын
thanks for the video
@ernestisaev6543
@ernestisaev6543 Жыл бұрын
Hi ! Can you pls answer for some important questions for me ? 1) What the monitor u use ? (inches) 2) What the scaling for display u use? P.S. Sorry for my English ( I am from Ukraine
@aryavbhola3066
@aryavbhola3066 Жыл бұрын
Damn, i remember figuring out how to use all properties in transform as if i do it in another line it overwrite the previous property
@IINoirII
@IINoirII Жыл бұрын
"rotate: x/y/z + angle" rule is not supported in Safari, but it's fine, I guess
@hunghung9537
@hunghung9537 Жыл бұрын
Z dimension is important if you want to overlap image.
@kshitijchaturvedi9087
@kshitijchaturvedi9087 Жыл бұрын
Nice tutorialiii
@MinhTran-ve6gl
@MinhTran-ve6gl Жыл бұрын
Have any conflict between transform: translate and translate?
@aybak3k
@aybak3k Жыл бұрын
FINALLY! IT'S ABOUT FREAKING TIME
@palandrascsokan638
@palandrascsokan638 Жыл бұрын
I used transform a few times before, but one thing I don't understand why does my code look different sometimes in Codepen and in regular browser window? Basically is the same code.
@CSSWeekly
@CSSWeekly Жыл бұрын
Codepen, by default, includes a CSS reset (Normalize); so if you do not include one manually, it could be a culprit for minor differences.
@wfl-junior
@wfl-junior Жыл бұрын
Finally. This is awesome.
@spreadItWide
@spreadItWide Жыл бұрын
WHAT!!!! Thank god!
@markshall94
@markshall94 Жыл бұрын
We could solve problem 2 with the @property directive
@CarlitoProductions
@CarlitoProductions Жыл бұрын
The only thing is that it seems not to be supported by most web browsers just yet, so it wouldn't be possible to use it for involved projects. But once it comes into full effect it will be awesome
@keifer7813
@keifer7813 Жыл бұрын
Me, last week: Wow, this transform property came in handy. I'll probably use it a lot from now on 0:01
@cinematwenty-2060
@cinematwenty-2060 Жыл бұрын
For so wierd reason when I try to use the GMS it just make one loud noise..
@furkanolmezoglu8599
@furkanolmezoglu8599 Жыл бұрын
Dive in!!
@myquyenthai4802
@myquyenthai4802 Жыл бұрын
Thanks!
@WebDevSimplified
@WebDevSimplified Жыл бұрын
Thank you for the support!
@Mati2007PL
@Mati2007PL Жыл бұрын
5:40 actually you can animate custom properties but only after u define their type. example: @property --rotate { syntax: ''; inherits: false; initial-value: 0deg; }
@BostYT
@BostYT Жыл бұрын
Kyle doesn't really know what he's talking about, throwing around false claims
@eduazy
@eduazy Жыл бұрын
Firefox doesn't support custom properties
@blackpearl1066
@blackpearl1066 Жыл бұрын
Life saving!!! 😭
@Nodsaibot
@Nodsaibot Жыл бұрын
great for the CSSbattle (cssgolf)
@jaidCodes
@jaidCodes Жыл бұрын
I thought this will be about transformers like PostCSS.
@zainax4099
@zainax4099 Жыл бұрын
send you the link of it
@komakaze1
@komakaze1 Жыл бұрын
How is performance?
@devviz
@devviz Жыл бұрын
plain css so it should be very smooth
@nxtaaa
@nxtaaa Жыл бұрын
But we used to use 3d transforms specifically because they would trigger hardware acceleration to make for smoother animations
@Rust_Rust_Rust
@Rust_Rust_Rust Жыл бұрын
No
@WrathfulFakey
@WrathfulFakey Жыл бұрын
yeah but it only is supported in Firefox, isn't it? i believe it's still not supported enough to use it and think it works for everyone
@douthedev5338
@douthedev5338 Жыл бұрын
Finallyyyyy!!
6 Advanced Flexbox Features You Probably Don’t Know
14:54
Web Dev Simplified
Рет қаралды 109 М.
CSS transform. 2D и 3D трансформации translate, scale, rotate и другие
26:40
Фрілансер по життю
Рет қаралды 185 М.
WTF Do These Even Mean
13:44
Web Dev Simplified
Рет қаралды 75 М.
10 Tailwind Classes I Wish I Knew Earlier
13:31
Web Dev Simplified
Рет қаралды 163 М.
Using CSS custom properties like this is a waste
16:12
Kevin Powell
Рет қаралды 159 М.
CSS Anchor Is The Best New CSS Feature Since Flexbox
15:39
Web Dev Simplified
Рет қаралды 357 М.
Make Awesome SVG Animations with CSS // 7 Useful Techniques
12:20
Avoid These 5 Awful CSS Mistakes
20:42
Kevin Powell
Рет қаралды 189 М.
Top 10 Advanced CSS Responsive Design Concepts You Should Know
20:16
Web Dev Simplified
Рет қаралды 500 М.
Learn useMemo In 10 Minutes
10:42
Web Dev Simplified
Рет қаралды 465 М.
Learn CSS Transform In 15 Minutes
14:37
Web Dev Simplified
Рет қаралды 168 М.
6 things I wish I knew about CSS when I started
9:09
Kevin Powell
Рет қаралды 224 М.