CSS @property and the New Style
The CSS @property at-rule now supports custom properties, enhancing animated gradients and transitions. It offers techniques for hover effects and shiny borders, with resources for further exploration provided.
Read original articleThe CSS @property at-rule has recently gained support in modern browsers, allowing developers to define custom properties with specific syntax, initial values, and inheritance. This advancement is part of the CSS Houdini initiative, which aims to enhance the capabilities of CSS. The article explores various applications of the @property rule, particularly in creating visually appealing call-to-action elements on websites. It details how to implement animated gradients and smooth transitions using custom properties, including techniques for achieving shiny borders and hover effects. The author provides code snippets demonstrating how to create rotating gradients and shimmering effects, emphasizing the importance of defining custom properties for seamless animations. Additionally, the article discusses methods to enhance hover interactions, such as slowing down animations and adding depth to button designs. The potential of @property in large-scale applications and design systems is highlighted, suggesting a promising future for CSS development. The article concludes with a list of resources for further exploration of animated CSS techniques.
- The @property at-rule allows explicit definition of CSS custom properties.
- It enhances the creation of animated gradients and smooth transitions.
- Techniques for shiny borders and hover effects are discussed.
- The potential for @property in large-scale applications is emphasized.
- Resources for further learning about animated CSS are provided.
Related
CSS Surprise Manga Lines
The article explains creating a manga-style surprise effect with CSS, focusing on replicating character facial lines. It suggests using GIF overlays for better performance than CSS animations. Published on July 2, 2024.
@property: Next-gen CSS variables now with universal browser support
The CSS Houdini APIs now universally support the @property rule in modern browsers. This feature enhances CSS custom properties by allowing type definitions, fallback values, error handling, and advanced syntax for smoother property animations.
Don't Use JavaScript for That: Moving Features to CSS and HTML [video]
The video discusses the benefits of using HTML and CSS over JavaScript in web development, focusing on efficiency and inclusivity. It demonstrates creating custom switches with HTML checkboxes and CSS, emphasizing accessibility and styling techniques like "appearance: none".
SVG Triangle of Compromise
The article explores SVG (Scalable Vector Graphics) on the web, highlighting its stylability, cacheability, and dimensionality, while discussing advantages and challenges in web design and performance considerations.
Can you convert a video to pure CSS?
The article explores converting video content into CSS animations, highlighting browser compatibility issues, particularly with Safari, and suggesting JavaScript alternatives for cross-browser functionality while detailing performance differences.
- Many users express enthusiasm for the new features and potential of CSS, likening it to a "magical" evolution of the language.
- Some commenters find the complexity of the new CSS features overwhelming and question the necessity of adding such intricate capabilities.
- There is a divide between those who appreciate the creative possibilities of CSS animations and those who feel they lead to cluttered and distracting designs.
- Several users recommend additional resources for learning and understanding the new features, indicating a desire for clearer explanations.
- Concerns are raised about the potential for CSS to become as complex and problematic as JavaScript, with calls for a CSS blocker to manage excessive styles.
I looked at the CSS for the first codepen example, and it looks like gibberish to me.
Should we really have a mini animations programming language in the styling system? This seems like a bit much. More than a bit much.
Can't this be done with Javascript? I get that a lot of people have a knee-jerk negative reaction to using JS for everything, but it's a programming language... this is kinda its job.
I'll have to play around with @property myself to get a sense of how it works - knowing esoteric CSS features is a superpower if you've got a complex UI to implement but wanna minimize JS dependencies.
He has touched on exact feature a few times, here’s a video he uploaded a week ago that shows one useful feature that registered properties enables: https://youtu.be/U8NykwZNbGs
There’s also this article that breaks down registered properties with an easy-to-follow example: https://moderncss.dev/providing-type-definitions-for-css-wit...
But IE devs were unhinged. You could build JS code as a module and attach it to elements using CSS.
Finally we're getting those kind of unhinged features again.
https://css-tricks.com/exploring-property-and-its-animating-...
You will particularly like the Airport number/timer flip display type example.
From what I gather, this new feature lets you write:
from var(--gradient-angle)
Instead of just a raw value, like: 360deg
And the former effectively gets replaced with the latter, sourcing the value from where you defined it in a `@property --gradient-angle {...}` block.Plus there's the `inherits: false;` bit. I'm not sure what to make of that. What it does is clear enough but I don't understand why. CSS selectors already let you control inheritance. Now you can control it from a second place? I don't follow...
Also, why do I have to define the type in the @property block? I don't have to define types anywhere else in CSS. The browser can see where the @property is used, why can't it infer the type from that?
I've always loved noodling with CSS. After a decade+ of web dev and through making a career of web stuff I learned how much people seem to hate CSS.
I can pour countless hours into exploring and tinkering with hand rolled HTML+CSS. Deploying it just to see how it feels for real on my phone. And 99% of it all never going anywhere.
I guess for most people that's called a waste of time. Well this site sure does make my day =)
Really hope this aesthetic doesn't catch on.
What you can do in modern HTML+CSS+JS is incredible. Too bad people bury it down under millions of layers of frameworks and code transformers.
> Cascading Style Sheets (CSS) is a simple mechanism for adding style (e.g., fonts, colors, spacing) to Web documents.
I think somewhere "simple" got lost unfortunately.
Seems pretty gibberish. Theres already CSS vars and a bazillion less/sass/css-in-js preprocessors.
Who really needs this? Why make the spec so complex?
This must be the mentality of new CS students.
i wonder if we start to see the "css engineer" job posts sooner or later
Preferably a blocker that allows a sane subset of CSS so that normal formatting isn't impacted.
TLDR: you didn't actually need @property to do any of this magic.
Related
CSS Surprise Manga Lines
The article explains creating a manga-style surprise effect with CSS, focusing on replicating character facial lines. It suggests using GIF overlays for better performance than CSS animations. Published on July 2, 2024.
@property: Next-gen CSS variables now with universal browser support
The CSS Houdini APIs now universally support the @property rule in modern browsers. This feature enhances CSS custom properties by allowing type definitions, fallback values, error handling, and advanced syntax for smoother property animations.
Don't Use JavaScript for That: Moving Features to CSS and HTML [video]
The video discusses the benefits of using HTML and CSS over JavaScript in web development, focusing on efficiency and inclusivity. It demonstrates creating custom switches with HTML checkboxes and CSS, emphasizing accessibility and styling techniques like "appearance: none".
SVG Triangle of Compromise
The article explores SVG (Scalable Vector Graphics) on the web, highlighting its stylability, cacheability, and dimensionality, while discussing advantages and challenges in web design and performance considerations.
Can you convert a video to pure CSS?
The article explores converting video content into CSS animations, highlighting browser compatibility issues, particularly with Safari, and suggesting JavaScript alternatives for cross-browser functionality while detailing performance differences.