@property Is One Of The Coolest New CSS Features

  Рет қаралды 42,812

Web Dev Simplified

Web Dev Simplified

Күн бұрын

Пікірлер: 89
@nomadshiba
@nomadshiba Ай бұрын
you didnt talk about how it benefits transitions. because normally you cant transition custom properties because browser doesnt know the type of it, so it cant know how to transition it but with @property we can transition the custom properties.
@WebDevSimplified
@WebDevSimplified Ай бұрын
That is a great point!
@thewhite8782
@thewhite8782 Ай бұрын
Can you give an example or what to look up to understand this? I don't know what's meant with custom property transitions but I'm interested to know
@Olympix_
@Olympix_ Ай бұрын
@@WebDevSimplified I watch you from Uzbekistan! You are really increadible Developer But i wanted to ask you creating a carousel(swiper) in react-js with all components like:text, image, links(Not only with images) please Wait your respond
@w01dnick
@w01dnick Ай бұрын
@@thewhite8782 e.g. you have linear-gradient for button and want make a transition to another gradient on hover. It's a background image, which is discrete property, so it wouldn't transitioned, just immediate switch from one state to another. To overcome this you can create CSS variables --bg-top and --bg-bottom and use them in linear gradient. But browser doesn't know that they are colors, so it would transition them too. But with `@property` you can define them as '' and then gradient would be transitioned as desired.
@w01dnick
@w01dnick Ай бұрын
@@thewhite8782 e.g. you have linear-gradient for button and want make a transition to another gradient on hover. It's a background image, which is discrete property, so it wouldn't transitioned, just immediate switch from one state to another. To overcome this you can create CSS variables --bg-top and --bg-bottom and use them in linear gradient. But browser doesn't know that they are colors, so it would transition them too. But with `@property` you can define them as '' and then gradient would be transitioned as desired.
@morrowr08
@morrowr08 Ай бұрын
Can the `syntax` inside property be a variable? If so, could you potentially have all your color variables and then create a variable that is essentially an enum and dev can only select one of those options?
@sirajmussafirr147
@sirajmussafirr147 Ай бұрын
Yes, @property --box-color { syntax: "red | green"; inherits: false; initial-value: red; } .box { width: 200px; height: 200px; background-color: var(--box-color); } .box-2 { --box-color: blue; }
@GilGoldshlager
@GilGoldshlager Ай бұрын
Cool feature, thanks 👍
@injSrc
@injSrc Ай бұрын
The only use of this @propeties I see is the ability to transitions of custome property
@mikescholz6429
@mikescholz6429 Ай бұрын
Thats the reason I’ve been waiting for it.
@nwfashionmedia
@nwfashionmedia Ай бұрын
Feels like a solution looking for a problem. What does this solve? Someone constantly assigning px values to color variables? The only value I can see here is that maybe I can bill more hours because I had to make the CSS type-safe. Or maybe I can finally win that award for Most Overly Complex CSS.
@aimableruhumuriza8603
@aimableruhumuriza8603 Ай бұрын
That is true for most of framworks and libraries in these days. Instead of improving existing ones to solve new problems, a new one will be created and become must have skill to learn. It's crazy
@radhy9173
@radhy9173 Ай бұрын
By default browsers only knows css values as string, which make it disables behaviours like transitions for some stuff like gradient. Assigning it to the correct type allow browser to animate those by assigning the typed custom properties instead. That is the basic stuff this feature enables. More advanced use case would be usage of inside worklet to hack into low-level CSS engine with CSS Houdini so devs can author their own CSS styles that can be configured with CSS variables.
@andreybogdanov3
@andreybogdanov3 Ай бұрын
Congrats, you just discovered the purpose of TS🎉
@ChadElliott_THEtheChad
@ChadElliott_THEtheChad Ай бұрын
In addition to informing the browser what the variable type is so it can properly transition the value during an animation (something not covered in this video), it enables inheritance, default values, and helps enforce the usage of proper values, making it less likely to introduce inconsistencies or bugs. I would also like to note that it's opt in, and you can add types to existing variables at your discretion. Have a normal stylesheet and notice your Jr devs are constantly mangling a poorly named variable? You could simply add a type def for that variable and put some guard rails around it.
@Microphunktv-jb3kj
@Microphunktv-jb3kj Ай бұрын
.... seems like useful for the css lib authors. how many of actually have used vanilla css lately , instead of eg tailwind and others? :D
@franzitaz
@franzitaz Ай бұрын
In this video was not understanding the purpose of this @property. For someone that didn't understand: One of the use cases is to solve problems of animations in CSS. The best example of him is using @property in this video, in my opinion: kzbin.info/www/bejne/qYHFoXiijKZ9bJosi=NLNEMniA19ehiDV4&t=223 PS: I think that they could make the syntax simpler as well. But I imagine that it was the best that maybe they could implement. /*Instead of:*/ @property --scale { syntax: ""; inherits: false; initial-value: 1; } /****************************/ /*Something like without the and inherits as optional:*/ @property --scale { syntax: "number"; initial-value: 1; }
@youcefg9760
@youcefg9760 Ай бұрын
I didn't notice this was added to Firefox in v128.0 (Jul 9th) Now only Paint API and Typed OM left to catch-up to the other browsers.
@geforcesong
@geforcesong Ай бұрын
excellent!!
@4120_PRATIKRATHOD
@4120_PRATIKRATHOD Ай бұрын
It's been a long time I'm using it for animations
@Jumanji_Dev
@Jumanji_Dev Ай бұрын
CSS becoming TypeScript 🤨Daaaamnnn 🙃
@soushi8885
@soushi8885 Ай бұрын
Next step : Typed HTML !
@AndrewTSq
@AndrewTSq Ай бұрын
Half of internets webpages would stop working then lol
@ErikErosa
@ErikErosa Ай бұрын
Sounds interesting but… "Errors should never pass silently unless explicitly silenced" so I'm not convinced. Thanks for the info, though!
@LatenightDev
@LatenightDev Ай бұрын
This will make future frontend dev more confused to figure out that custom property. Imagine it was named with spanish or latin words.
@davidcrowell3041
@davidcrowell3041 Ай бұрын
Why?
@IlyesCodes
@IlyesCodes Ай бұрын
Best question to ask, why the heck do we need type checking for a stylesheet
@youcefg9760
@youcefg9760 Ай бұрын
This is part of the CSS Houdini Properties and Values API Level 1 kzbin.info/www/bejne/qYHFoXiijKZ9bJo
@OneHundy
@OneHundy Ай бұрын
Is there a shorthand for this?
@tima1301
@tima1301 Ай бұрын
💛💙
@tommysmith5479
@tommysmith5479 Ай бұрын
You keep saying "custom properties" - do you mean variables?
@otaviocf4657
@otaviocf4657 Ай бұрын
the official documentation calls it custom properties
@tommysmith5479
@tommysmith5479 Ай бұрын
@@otaviocf4657 Ok - I just wanted clarification: so custom properties are variables - var()?
@Oskinavara
@Oskinavara Ай бұрын
@@tommysmith5479 yes
@tommysmith5479
@tommysmith5479 Ай бұрын
@@Oskinavara Thanks all. That's rather confusing!
@the-iter8
@the-iter8 Ай бұрын
Honestly it seems like a solution that no body really needed, I would rather put some safety rules on properties like color, fontsize etc to not to accept raw values but to only accept variables. Not related to type safety but would be a great-kind-of-contextual solution
@FalioV
@FalioV Ай бұрын
No tnx. I dont see how this will benefit me at all. I prefer to use out of the box UI library and style the components and put more effort in more complex part of the app then the visual looking. Those features will remain unusable (as many out there) for big part of the developers. Other then that interesting topic and good video as always! :)
@rodrigolaporte274
@rodrigolaporte274 Ай бұрын
VERY cool!
@AndrewTSq
@AndrewTSq Ай бұрын
so CSS is soon a destroyed thing if they add types into it.. why??
@dariantrama2591
@dariantrama2591 Ай бұрын
Maybe include a real world useful example for why this is actually helpful? I see in the comments that this could be helpful for transitions or animations but aside from that this just seems like over complicating CSS for little to no reason. I can control the colors of my divs just fine without it!
@anothermouth7077
@anothermouth7077 Ай бұрын
Another thing to be demanded by the recruiters which serves no purpose 😂
@hishamelfangary722
@hishamelfangary722 Ай бұрын
No. Stop. Just stop.
@MrJloa
@MrJloa Ай бұрын
Over engineering 👍 Solves imaginary problem yey
@IlyesCodes
@IlyesCodes Ай бұрын
This is really a headache to think about, i dont see a reason to add type checking to css it is just a styling language. Next step HTML type checking
@adamstuartclark
@adamstuartclark Ай бұрын
Feels like CSS didn't really need this feature.
@nEMOheartTaco
@nEMOheartTaco Ай бұрын
Back when I was focused on building CSS frameworks and component libraries, this would have been really helpful. I think it just depends on your use-case.
@LatenightDev
@LatenightDev Ай бұрын
@@nEMOheartTaco We already have root property, why you want to named your own property and become hard to understand for everyone ?
@OmriTurge
@OmriTurge Ай бұрын
Terrible, and useless. No need any type safety in css, people should stop with this fashioned thing
@markg5891
@markg5891 Ай бұрын
Oh my... Web development truly has gone ludicrously stupid. CSS is "fairly" strong typed. You have a property (color) which can have a defined set of values. But no, people wanted variables to "clean up" redundant css and reuse. And yes, for big css files it does look better with variables. And it might even be vital for themes. Now people want those variables to have that same strong type as CSS has without variables. So lets pollute the CSS with more garbage to have strong typed properties. And why? Because devs apparently make mistakes and fill in the wrong type (like pixels) where a color is intended...Thus this type safety is __ONLY__ a developer aid. It serves __NO__ purpose when you visit your site. Next i suppose we're gonna get "css debug symbols" akin to .map files for js. A file describing the property strong types. If you want to have a "typescript for css" (which this essentially is going to boil down to) then just cram this bs into SCSS and leave it out of the plain CSS files. If you have those dreaded .map files your browser already shows you the scss files so just go that route if you like added complexity. End of my rant...
@linela
@linela Ай бұрын
Yeah, this is a high level of stupidity...
@SardenR
@SardenR Ай бұрын
Maybe before before spouting so much bs learn a little about the thing you shiting about? @property has been there for a while along with other new low-level CSS features like houdini, paint API, etc for years now. If you think this feature is merely for type safety that serve no purpose whatsoever only shows how informed you are about the topic you are talking about.
@markg5891
@markg5891 Ай бұрын
@@SardenR Thank you for pointing me to that! Years means nothing for a feature to get standardized and usable everywhere, which is what this "@property" is about. Reg. houdini and paint api. I looked into it. It ties CSS and js even more, the exact opposite of what i want. It makes it even worse then i thought.
@radhy9173
@radhy9173 Ай бұрын
​@@markg5891 it doesn't mean anything that it is the exact opposite of what you want because many people have been waiting and watching the progress for about 4 years now. Many people including me would like the ability to hack into low level engine of CSS with houdini features and worklet, @property is one of the foundation being worked upon to achieve that and just because you don't like it won't make it less important to the rest of us.
@Developer_hubs
@Developer_hubs Ай бұрын
Thou shall not make CSS difficult with useless features!
@noggstaj
@noggstaj Ай бұрын
durrrrrp
@floppa9415
@floppa9415 Ай бұрын
Browsers are adding the most random stuff to CSS without fixing basic stuff really annoys people, mainly that when doing complex layout stuff everything behaves in a so unpredicatably.
@specy_
@specy_ Ай бұрын
For example? What's some basic stuff that needs fixing
@richarddefortune1329
@richarddefortune1329 Ай бұрын
Curious as well
@AndrewTSq
@AndrewTSq Ай бұрын
I would like in drag & drop elements, that we could style the dragged element.
@fathimashaikha996
@fathimashaikha996 Ай бұрын
Wow
@arslan._.iftikhar
@arslan._.iftikhar Ай бұрын
.
@diadetediotedio6918
@diadetediotedio6918 Ай бұрын
uh, this is more verbose than needed, I don't think it makes that sense. But if it fits your usecase, have some fun.
@KimBarimg
@KimBarimg Ай бұрын
im early, yey✨
@engine_man
@engine_man Ай бұрын
Except css rules have always had a specific type of value you can use.
@AVidhanR
@AVidhanR Ай бұрын
WoW WoW that's a good feature for real 🎉
@IlyesCodes
@IlyesCodes Ай бұрын
Why the heck do we need types in css? Are we really trying to overcomplicate the simple things here? WHY DO WE NEED TYPES IN CSS I DONT GET IT
@OmriTurge
@OmriTurge Ай бұрын
Simple, we dont😂
@IlyesCodes
@IlyesCodes Ай бұрын
@@OmriTurge XD TRUE
@munna5553
@munna5553 Ай бұрын
HTML, CSS alway a shit in never be a improved 😊
@linela
@linela Ай бұрын
Can you stop shaking your head so often?
@GHSB7462
@GHSB7462 Ай бұрын
?
@secretsquirrel5566
@secretsquirrel5566 Ай бұрын
Can you shut up and just learn?
@charleschukwuemeka8482
@charleschukwuemeka8482 Ай бұрын
Stop watching his videos if that irritates you. It's the audacity for me
@yonnierenton6177
@yonnierenton6177 Ай бұрын
says so much, please don't make him change? like he is real-time explaining with expression/s and passion. (focus on the code) const result = shakeDetected ? (goodContent && tested && knowledgeable ? "❤ Love it: the shake is perfect, priceless, don't ever change!" : "⚠ Shake detected, but needs some refinement.") : "🤔 No shake or unclear movement, let's work on it."; and he shows us, what is good if he believes in it, does it work, can he stand by it etc... cheers. much love!
@yonnierenton6177
@yonnierenton6177 Ай бұрын
what did I learn, use tailwind lol, hope this is taken good, what I say. meaning this is good, love it everything about this channel, cheers.
@masaratech
@masaratech Ай бұрын
Bullshit
@sanan4li
@sanan4li Ай бұрын
Feel sad for people still prefer unmaintainable css over tailwindcss
@HomePhone-y2s
@HomePhone-y2s Ай бұрын
Feel worse for people that still believe class based frameworks like tailwind for CSS is actually understanding CSS
@noggstaj
@noggstaj Ай бұрын
yes, putting your css directly in your html is the way to go!
Master CSS Overflow/Text Wrapping Like A Senior Developer
20:53
Web Dev Simplified
Рет қаралды 58 М.
Using CSS custom properties like this is a waste
16:12
Kevin Powell
Рет қаралды 178 М.
СКОЛЬКО ПАЛЬЦЕВ ТУТ?
00:16
Masomka
Рет қаралды 2,3 МЛН
Triple kill😹
00:18
GG Animation
Рет қаралды 18 МЛН
Disrespect or Respect 💔❤️
00:27
Thiago Productions
Рет қаралды 37 МЛН
这是自救的好办法 #路飞#海贼王
00:43
路飞与唐舞桐
Рет қаралды 131 МЛН
Top 10 Advanced CSS Responsive Design Concepts You Should Know
20:16
Web Dev Simplified
Рет қаралды 536 М.
We Can Finally Animate height: auto; in CSS!
12:59
Web Dev Simplified
Рет қаралды 69 М.
Am I Good Enough To Solve These CSS Battles?
28:26
Web Dev Simplified
Рет қаралды 90 М.
How To Study Programming The Lazy Way
11:15
The Coding Sloth
Рет қаралды 561 М.
What’s Up with Laravel? It’s Everywhere, and Here’s Why!
6:22
Reacting to Controversial Opinions of Software Engineers
9:18
Fireship
Рет қаралды 2,1 МЛН
How To Handle Permissions Like A Senior Dev
36:39
Web Dev Simplified
Рет қаралды 80 М.
At Last! Simple details/summary animation with pure CSS
12:36
Kevin Powell
Рет қаралды 28 М.
CSS Anchor Is The Best New CSS Feature Since Flexbox
15:39
Web Dev Simplified
Рет қаралды 374 М.
СКОЛЬКО ПАЛЬЦЕВ ТУТ?
00:16
Masomka
Рет қаралды 2,3 МЛН