We're a place where coders share, stay up-to-date and grow their careers.
Create templates to quickly answer FAQs or store snippets for re-use.
Be aware that rendering-heavy properties like filter are not too good for performance when you have a lot of images out there.
Yes, coding is all about trade offs. So it all depends on use cases ☺
Agreed, definitely do not use too many advanced CSS attributes like this: codepen.io/ivorjetski/pen/dBYWWZ
That's awesome 😍😍😍
thanks for the tip!
You have to admire the hidden power though. SVG filters are a science into themselves and can be used with this CSS property.
Anyway do you know of any benchmarks?
Don't have any data to show you, just words from experience and checking this stuff on private projects.
What I've found is that CSS filters performance drops are most visible when you're using them in animations. It can really screw up the UX. And when using it just for initial display - on high-end PC-s you might not even see the difference, but it's certainly noticeable on mobile devices.
I have some data and its really not that bad!
Thank you ever so much Una :D
you're abosolute right.!!
Thanks! 🙂 For your question related to browser compatibility refer to this comment
Recently i tried mix-blend-mode but due to some strange reason, it did not work on one of my android phone chrome browser. Worked on others. So, the point is to make sure it works for you on supported platforms.
Yes, of course, we should always to check for browser support. But the good thing about CSS is that we can always add fallback styles in cases where our desired css properties are not supported. If a property is not supported CSS won't throw out errors, it will silently cascade to other styles so adding fallback styles works out of the box.
Completely agree. Thanks
BTW some feedback about this:
There is no need to be so harsh. You can give critical feedback without coming off this way. Also, the author did give the info in the article that some of these properties are not fully cross-browser yet, but that should not bar authors from talking about them.
Thanks Sara! 🙂
Sorry, did not mean to be harsh. If this is what you've read it as, I apologize. This just makes me upset a little, because browser diversity is important.
Yes, it's mentioned, but as I said: Don't get used to it (=creating for one browser).
And by stating - "Please use Chrome to view the examples", I am not advocating Chrome only websites but the reason was simple enough so that people can actually see the examples.
Okay, fine. Understood. And obviously, I agree with your polyfill/fallback part.
Anyway, I keep my point that sentences like these ("use XY for viewing this!") create a bad incentive/habit. Anyway, it gets off-topic, so let's agree to disagree. :)
I'm fairly certain that CSS content and by extension attr() is not read by most screen readers + browser combination, being part of presentation rather than real content. I'd reconsider the recommendation unless I'm wrong then find tell me to pipe down. 😁
From accessibility point of view I meant that when we add such content like tooltip on hover, what we can do is add the content in aria-label which will be read by the screen reader and then make use of the samearia-label through are CSS with attr() for the normal flow. In that way we can have consistent content throughout.
Probably should've explained better 🙂
Hi Anya, thanks for the post, do you mean like this?
<p>hello a11y text, important info</p>
<p aria-label="hello a11y text"><!--hello a11y text-->important info</p>
Case 1 reads "paragraph, hello a11y text, important info"
Case 2 reads "paragraph, hello a11y text" only but displays the same as case 1.
aren't the 'aria-label' tags outdated now?
No? aria-label attributes still very much a day to day support attribute. They are just not great to use unless you have to, your markup should describe your SR journey without needless overides. Do you have any specification to suggest they are out of date?
If what you're doing is purely decorative or there is accompanying text, etc., then no, it's not a, "You can't use it because it's inaccessible." There's certainly use cases for CSS content, for example, that are perfectly fine. It just depends on their use.
Not what I'm saying. And I quote "This method could be really helpful with accessibility purposes." This is not true.
In the codepen example the tooltip will never be explained to blind users, so in affect, sighted users will get the context but not the blind user. So I stand by what I said. CSS content should be used with care.
Informative article! Thanks!
The conic gradient codepen doesn't seem to be doing anything (Firefox Nightly) -- I just see a white page. What am I missing?
Use Chrome. I'm on the latest mobile release and it works
No. "Use some other browser" isn't a solution. Especially when that other browser is Chrome.
Web standards exist for a reason -- if this only works in Chrome, it's nice to know what to avoid; however, your reply has led me to the answer I was looking for: having a look at MDN, Chrome and variants are the only browsers to support this, meaning it's not ready for web consumption.
Great post Ananya! I wasn't aware of some of these properties, e.g. backface-visibility. Looking forward to your next post. 🔥
I had never heard of box-decoration-break, that's really cool!
FWIW, all of the examples work in Safari. Everything but conic gradient and scroll-snap work in Firefox also. The backface-visibility example will work everywhere if the -webkit-prefixed version is added (for Safari) and the non-prefixed version to .flip-card-inner (for Firefox).
The filters one had me yelling at my screen. Excellent list - definitely one I'll save.
conic-gradient is awesome, I've been looking for it for a few months now. Thanks for the article!
It's a pity that it's only supported by Chrome yet, but the future is bright! 😌
To add my surprising feature:
And 12. Your website can have a dark mode chosen by your operating system..
CSS modal: codepen.io/Smakosh/pen/bYVVbL
Emoji validation: codepen.io/Smakosh/pen/owMzgw
These examples are really great! 🙂
Thank you! just shared your article with my co-workers!
Wow! Great article, thank you! Some are really really cool!
ps. conic-gradient doesn't work on Firefox (but I saw the result on Chrome).
Yes, I agree browser compatibility is an issue as with so many other features on the web but with CSS we can easily check support with @supports and add fallback styles accordingly. If a property is not supported CSS won't throw out errors, it will silently cascade to other styles so adding fallback styles works out of the box.
I'm viewing this content through the latest stable build of Firefox, and see a lot of broken image icons. Not sure degradation is working as expected.
With Google deliberately breaking ad blockers in future Chrome versions, there are likely going to be a lot more Firefox users sooner than later.
Great article Ananya -- I had no idea of half or more of these CSS properties! It's great to see CSS taking over typical things that we had to do in Photoshop like drop shadow on an image and now even filters.
Thanks for sharing! 🎉
Wow, Many of them I didn't know. Thank you for the amazing post!
Very interesting, I didn't know many of the functions at all. But I will use some of them in the future. Great post
Great tips! Thanks for sharing.
Some nice things here but like others I'd prefer to read such lists with only stable well supported features not browser specific stuff, that needs fallbacks. Just my preference as I'm interested in building sites that just work and while I'm happy to expect people to gave basically the latest browser in their context, I am not interested in asking them to use a particular browser (that defies the freedom of the web for me).
Amazing post Ananya! It really blew up!!
Looks like Redditors came to nitpick. Nice job being positive 😄
Thanks Ben! 🙂 It did blow up beyond my expectations. 😅
Intresting, some of them I haven't heard. Loved the gredient text color and pie chart.
Thanks for digging and sharing with us.
Great read. got to know a lot of new things in CSS. filters are amazing. Thanks for sharing
Weird, does box-decoration-break only applies its effect when affected element is resized?
Interesting post btw
I'm not sure what you mean by when element is resized.
box-decoration-break gets applied when the text breaks into next line.
I can't really tell from the article what that property is supposed to do. The other examples all have different states so you can compare one with another.
great article! Thanks you very much...
Wow, worth bookmarking this!
A good collection to apply on the next landing pages I develop next.
Awesome. Thanks for sharing!!!
Awesome :) I really didn't know that CSS has the flipping of picture function
Just to be clear backface-visibility doesn't directly flip. The flipping is achieved by the combination of transform and backface-visibility. 🙂
Thank you for this post!!
First time I see most of these attributes. And they look great. Thank you!
I had no idea about the scroll snapping. That's friggin amazing!
Wow - Amazing!
Like this so much! Thanks!
Lovely thanks Ananya!
This is so cool, thank you very much :)
The conic-gradient blew my mind !
Thanks! Very useful tips here!
Added to my bookmarks for later.
Article really cool!!
I fucking love this post ❤️ Even though I know most of these, I love that you are sharing the power of CSS 😉
That conic-gradient effect is cool but has very limited cross-browser usage... Good post though :)
Great post, very practical and fun.
This has blown my mind. Thank you so much for sharing! :)
very cool, but i wonder though how well supported these are across browsers. thanks for showing the examples.
You can use caniuse to see how well-supported things are, and a great thing about CSS is it tends to gracefully degrade anyway.
This is really impressive. Great post Ananya. Looking forward to your next article.
This is really helpfull in so many situations! Thanks for sharing!
You have done a fantastic job to put it back for community. Thank-you. It's a must save list in mind!
Some very cool stuff, I look forward to playing with some of this.
first-letter ... that's so cool.
I love that kind of stuff, I will use this as soon as possible.
Thanks a lot for this article!
I didn't know these properties existed, thanks for sharing. 😊🙂
Thanks Emma 🙂
Thanks for the article on what css and HTML can simply do without the Js.....
It was a seminal article. Thanks 😄
I just learned about the text gradient the other day! Thanks for sharing, always fun to learn about CSS and it's expansive capabilities.
This was great! Learnt loads of interesting CSS techniques that I'm definitely looking into.
Wow, that's awesome.
Wow, I'm trying out these properties right now
Nice one. I didnt know CSS was so powerful!
Great article. 2nd one is amazing.
That's pretty neat. I had no clue you could add filters or text gradients via css.
Hi, I'd like translate this amazing tutorial to Chinese. Can you give me the permission? The translated text will be published on nextfe.com. Thanks in advance.
Hey! Sure, you can translate it as long as you link back to the original post :)
Do share the link once it's published.
Just finished the translation: nextfe.com/css-can-do-that/
The original post is back-linked at the beginning of the translated text.
Wow, actually im going to use "Smooth scroll snap" in my proj right now! thank you
Don't I just love this lady already, thank you for the new library.
Hi Ananya I'm impressed with your css skills I have a whatsapp group dedicated to coders to collaborate fun hobby projects I would love you to join my whatsapp group ping me +918970787208
Very insightful !
very Nice, well job friend
Hey this is an awesome article. Thank you!
Here's an awesome take on Interstellar theme that goes great as background music while trying out these css tricks
Good reading. I am just wondering about the browser compatibility.
Refer to this comment on browser compatibility.
Nice article Ananya. Thanks.
I say almost every day in my work: with CSS you can do what the f*** you want, about layout & similar. Stop.
awwwww thank you so much for this great post, i just save it so that i can recheck it later <3
I am learning, thanks! 👏👏👏
This is really cool.
Like background-clip, scroll snap..
backface-visibility, my favorite one!
Some of these things are webkit/blink only, so those are not that great.
Internet explorer : NOPE NOPE NOPE NOPE!!
Neat！I never know CSS can do filter! Wow! Thank you!
We're a place where coders share, stay up-to-date and grow their careers.