CSS Transform Is Dead! Use This Instead

Поделиться
HTML-код
  • Опубликовано: 23 янв 2025

Комментарии • 237

  • @jfftck
    @jfftck 2 года назад +31

    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.

  • @ZR-194
    @ZR-194 2 года назад +293

    Getting to use that in projects 3-5 years from now will be amazing.

    • @wallacesantos0
      @wallacesantos0 2 года назад +28

      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

    • @ZR-194
      @ZR-194 2 года назад +102

      @@wallacesantos0 all good, unless you plan to support iPhones. IE didn't go anywhere, nowadays we just call it Safari.

    • @trappedcat3615
      @trappedcat3615 2 года назад +12

      @@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 2 года назад +8

      Time to write a webpack loader then.

    • @mansch55
      @mansch55 2 года назад +8

      @@ZR-194 iOS supports this since version 14.1

  • @IdleAtre
    @IdleAtre 2 года назад +30

    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 2 года назад +1

      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.

    • @ethisfreedom
      @ethisfreedom 2 года назад

      @@chinhtrung6130 agree

  • @mr.doubled4766
    @mr.doubled4766 2 года назад +8

    I got say man this really makes web development simplified 😇

  • @colettemr
    @colettemr 2 года назад +57

    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 2 года назад +4

      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 2 года назад +1

      not anymore my friend.. :D

    • @yestermonth
      @yestermonth 2 года назад

      Still popular in Japan

    • @theodorealenas3171
      @theodorealenas3171 2 года назад

      @@yestermonth wait what?

    • @yestermonth
      @yestermonth 2 года назад +5

      @@theodorealenas3171 Yeah, a lot of Japanese institution still heavily rely on IE, part of the reason why Microsoft haven't fully phased it out.

  • @boiimcfacto2364
    @boiimcfacto2364 2 года назад +85

    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 2 года назад +6

      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 2 года назад +3

      @@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 2 года назад

      I agree, be straight up with the titling and descriptions of videos. I hate clickbait cr*p.

    • @NECOdes
      @NECOdes 2 года назад

      having clickbait doesn't change the content of the video tho, it's just there to attract more attention and play with RUclips algorithm

    • @rea1m_
      @rea1m_ 2 года назад +4

      @@NoeruCranel 80% is still insufficient amount tho

  • @alperemir5529
    @alperemir5529 2 года назад +5

    This is a great feature for who always writing " translate: transform(); " every time ! :D

  • @gauravvishwakarma8111
    @gauravvishwakarma8111 2 года назад +1

    Congratulations for 1million subscribers... 👍👍👍👍
    Love from India 💓💓

  • @Mazoane
    @Mazoane 2 года назад

    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

  • @advaittrivedi5905
    @advaittrivedi5905 2 года назад +3

    Actually your videos are so much fun to watch it's like getting entertainment and information at the same time... Great job Kyle... 🙌🏻🙌🏻🤩

  • @rfryanfavour4369
    @rfryanfavour4369 2 года назад

    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

  • @advaittrivedi5905
    @advaittrivedi5905 2 года назад

    Also want a seperate video of you playing that awesome guitar at the back 😂🤣 it's been with us in our entire journey

  • @myquyenthai4802
    @myquyenthai4802 2 года назад

    Thanks!

  • @itsmaxim01
    @itsmaxim01 2 года назад

    softs it was really confusing but thanks to you I've gotten more professional at it!! ✌

  • @ziweiwang3311
    @ziweiwang3311 2 года назад +29

    hey guys, before you use this new feature, make sure to check its compatibility with the browsers on caniuse or MDN.

    • @jensgur
      @jensgur 2 года назад

      Yeah there are do many great properties we can't use because companies still using old browser versions:(

    • @andrewilliams4500
      @andrewilliams4500 2 года назад

      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?

  • @iam-mehrab
    @iam-mehrab 2 года назад

    He is sitting there to save your time, make you smile while staring at your code running in awesome way.

  • @ascourter
    @ascourter Год назад

    Great video. To the point and really good examples. Was able to watch this and now can use scale, rotate, translate. Thanks!

  • @Chalisque
    @Chalisque Год назад +1

    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.

  • @ggorg0
    @ggorg0 2 года назад +8

    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!

  • @travisv
    @travisv 2 года назад +3

    Do you still need to use transform-origin or how do you change that value for the new individual properties?

  • @mujibulhaquetanim
    @mujibulhaquetanim 2 года назад

    please make videos on new css/Javascript features regularly

  • @KalenMaahs
    @KalenMaahs 2 года назад

    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.

  • @thecodingchef9292
    @thecodingchef9292 2 года назад +1

    Why do i have a feeling you actually suggested these changes to the css team, this really simpifies our lives, webdev indeed simpified

  • @thekitspecial
    @thekitspecial 2 года назад +1

    do new properties mess up z-index stacking like transform does?

  • @gametroll6311
    @gametroll6311 2 года назад +2

    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.

  • @LePhenixGD
    @LePhenixGD 2 года назад +6

    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 2 года назад +2

      My best suggestion is to simply try it. Also kind of strange that those two have different results.

    • @MartynDunnMusic
      @MartynDunnMusic 2 года назад +1

      @@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 2 года назад

      @@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.

  • @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.

  • @ChrisMochinskiMusic
    @ChrisMochinskiMusic 2 года назад

    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?

  • @CodeWithSahand
    @CodeWithSahand 2 года назад

    useful and well explained, thanks

  • @Mati2007PL
    @Mati2007PL 2 года назад +7

    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 2 года назад

      Kyle doesn't really know what he's talking about, throwing around false claims

    • @eduazy
      @eduazy 2 года назад +2

      Firefox doesn't support custom properties

  • @SirChogyal
    @SirChogyal 2 года назад

    Rotation is cool. I like it. Now I am using it.

  • @danielrondongarcia9905
    @danielrondongarcia9905 Год назад

    Great!! Thanks for sharing your knowledge!

  • @webdev___bappa4289
    @webdev___bappa4289 2 года назад +1

    Great. Informative video.

  • @Sacramentix
    @Sacramentix 2 года назад +1

    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

  • @connect_to_the_dots
    @connect_to_the_dots 2 года назад

    Oh, I goodly want to hear so!

  • @midnightinsane6893
    @midnightinsane6893 2 года назад

    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.

  • @joerivde
    @joerivde 2 года назад +1

    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?

  • @Lee-zh2mc
    @Lee-zh2mc 2 года назад

    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.

  • @multiwebinc
    @multiwebinc 2 года назад +1

    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 2 года назад

      I have this issue - it’s a minor OCD thing (I also obsessively clear my throat).

  • @QwDragon
    @QwDragon 2 года назад +1

    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?

  • @salmanhossain1637
    @salmanhossain1637 2 года назад +2

    Thanks for the
    information

  • @thelastninja4825
    @thelastninja4825 2 года назад

    finally ! no need to keep the state with multiple transform elements, thank

  • @aravindprabha4656
    @aravindprabha4656 2 года назад

    Super 👌 bro clear cut explanation

  • @atg878
    @atg878 9 месяцев назад +1

    how i can make transform: rotatex(20deg) rotate(30deg) by the new css feature

  • @cinematwenty-2060
    @cinematwenty-2060 2 года назад

    For so wierd reason when I try to use the GMS it just make one loud noise..

  • @sanatkumar7848
    @sanatkumar7848 2 года назад +2

    Hi Kyle. Can you please mention the sites where you read about front-end development things

  • @clarkdnro
    @clarkdnro 2 года назад

    very nice dude but how much memory eats a rotating box ?

  • @Yous0147
    @Yous0147 2 года назад +1

    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.

  • @bobdinitto
    @bobdinitto 2 года назад

    Nice! Thanks for sharing!

  • @sabuein
    @sabuein 2 года назад

    As always, thank you, Kyle.

  • @salmanhossain1637
    @salmanhossain1637 2 года назад +3

    Finally, it came 🤗🤗🤗

  • @ventsislavstoimenov4404
    @ventsislavstoimenov4404 2 года назад

    Great video as usual 👌 Thank you, Kyle! Will it work also for styled components?

  • @eriscrypt
    @eriscrypt 2 года назад +1

    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

  • @jenstornell
    @jenstornell 2 года назад

    I think example two could be solved by specifying that the rotate custom property is a number. Look at Lea Verous videos.

  • @khaledbudajaja6137
    @khaledbudajaja6137 2 года назад

    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

  • @MinhTran-ve6gl
    @MinhTran-ve6gl 2 года назад

    Have any conflict between transform: translate and translate?

  • @bloodylupin
    @bloodylupin 2 года назад

    That's a game changer, thanks for the info 💎

  • @theohallenius8882
    @theohallenius8882 2 года назад

    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 .

  • @hunghung9537
    @hunghung9537 2 года назад

    Z dimension is important if you want to overlap image.

  • @aryavbhola3066
    @aryavbhola3066 2 года назад

    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 2 года назад +2

    "rotate: x/y/z + angle" rule is not supported in Safari, but it's fine, I guess

  • @vasyaqwe2087
    @vasyaqwe2087 2 года назад

    Can anybody share a link where I can look at the browsers compatibility?

  • @sobanya_228
    @sobanya_228 2 года назад

    Wow, Safarie 14 supports this and I've never even heard about it

  • @TimwiTerby
    @TimwiTerby 2 года назад +1

    The transform property allows you to specify an order. Doing a translate followed by a rotate is not the same as doing the rotate first. The new properties are less useful because they presume one order. Your claim about animations is misleading: you've stated that you cannot animate variables, but you left out that you can absolutely animate the transform property itself.

  • @wilkk7867
    @wilkk7867 2 года назад

    but what about transformOrigin...?

  • @meganweber5057
    @meganweber5057 2 года назад

    This is so great. I hope we get parent-relative units soon.

    • @Take-the-Ticket
      @Take-the-Ticket 2 года назад

      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.

  • @gabrielalves8643
    @gabrielalves8643 2 года назад

    Amazing. Thanks you man!

  • @abdoellhathiev9062
    @abdoellhathiev9062 2 года назад

    nice info, thanks kyle

  • @aybak3k
    @aybak3k 2 года назад

    FINALLY!
    IT'S ABOUT FREAKING TIME

  • @IsaacAlcocer
    @IsaacAlcocer 2 года назад

    You forgot to add the supported platforms or browsers and the version of CSS required for this.

  • @mohamedyoussef8835
    @mohamedyoussef8835 2 года назад

    Awesome info 😃😃

  • @dave6012
    @dave6012 2 года назад

    What about transform origin? Is there an equivalent for these properties?

  • @andrewilliams4500
    @andrewilliams4500 2 года назад

    Is it supported by all Browsers ? Can't seem to find any info on that? Especially wondering about Chrome, Firefox and Safari?

  • @dmitryutkin9864
    @dmitryutkin9864 2 года назад

    What about transform-origin? Is it applicable to new props?

  • @nustaniel
    @nustaniel 7 месяцев назад

    6:44 And matrix3d, I need my matrix3d to create proper looking flippy floppies.

  • @StrayKev
    @StrayKev 2 года назад

    Thanks for the video! This is a game changer

  • @markshall94
    @markshall94 2 года назад

    We could solve problem 2 with the @property directive

  • @yusufsaify6735
    @yusufsaify6735 2 года назад +1

    Awesome man great👍🏻

  • @WrathfulFakey
    @WrathfulFakey 2 года назад

    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

  • @truthteachers
    @truthteachers 2 года назад

    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...?

  • @markopolo2224
    @markopolo2224 2 года назад

    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 2 года назад

      You can't do it with CSS alone, but it's easy with a little javascript. Check out intersection observer: ruclips.net/video/2IbRtjez6ag/видео.html

  • @michelaveline
    @michelaveline 2 года назад

    Always good news!

  • @palandrascsokan638
    @palandrascsokan638 2 года назад

    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 2 года назад

      Codepen, by default, includes a CSS reset (Normalize); so if you do not include one manually, it could be a culprit for minor differences.

  • @ospha1
    @ospha1 2 года назад

    Love your tutorials.
    Can you show how to work ssl into express server to use https?

  • @davydo7566
    @davydo7566 2 года назад

    I recently just learnt abt perspective cos I had to make a transform card.. comes in handy

  • @williamcozzapereira8886
    @williamcozzapereira8886 2 года назад

    Thank you very much man

  • @callMeMahfuz
    @callMeMahfuz 2 года назад

    Thanks for latest information

  • @GnomePuntTrainerYT
    @GnomePuntTrainerYT 2 года назад +3

    The scale property has 79.58% overall browser support. It's cleaner code, but not hardly makes a difference compared to just using transform instead that has 98.68% overall browser support.

  • @keifer7813
    @keifer7813 2 года назад

    Me, last week: Wow, this transform property came in handy. I'll probably use it a lot from now on
    0:01

  • @CarlitoProductions
    @CarlitoProductions 2 года назад +2

    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

  • @abhisheksawant2376
    @abhisheksawant2376 2 года назад

    You are not going to want to use transform but you still have to because browser support. Chrome added these properties just this month. Not everyone updates their browsers. Please wait before jumping to this for your production code.

  • @komakaze1
    @komakaze1 2 года назад

    How is performance?

    • @devviz
      @devviz 2 года назад

      plain css so it should be very smooth

  • @zainax4099
    @zainax4099 2 года назад

    send you the link of it

  • @Karthik-ug8ll
    @Karthik-ug8ll 2 года назад

    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.

  • @youcube291
    @youcube291 2 года назад

    Thanks for information

  • @jaidCodes
    @jaidCodes 2 года назад

    I thought this will be about transformers like PostCSS.

  • @cool_scatter
    @cool_scatter 2 года назад

    Tailwind abstracts it away anyway, I haven’t written a transform property in ages. 😊

    • @3WL2
      @3WL2 2 года назад

      Thats like saying KFC sells chicken, I haven't made chicken myself in ages. Maybe you don't use transform, but you aren't every developer on the web.

    • @cool_scatter
      @cool_scatter 2 года назад +1

      @@3WL2 Where did I claim to be?

  • @jerryfleurival
    @jerryfleurival 2 года назад

    This is nice eliminating the word "Transform" when we already know the meaning of Scale, Rotate, and Translate. This is overdue. I hope this gets recommended by W3C.

  • @thevividversatilechannel4807
    @thevividversatilechannel4807 2 года назад

    I want this to happen for filter
    For example
    blur: 20px;
    hue-rotate: 45deg;
    instead of
    filter: blur(20px) hue-rotate(45deg);

  • @wavesky_pv
    @wavesky_pv 2 года назад

    Documentation source or something?

    • @nxtaaa
      @nxtaaa 2 года назад

      MDN all day every day