Chris’ Corner: Tricks With CSS
CodePen Blog
by Chris Coyier
4d ago
There are plenty of very legit reasons you’d want to have a scrolling element start out scrolled to the bottom, and stay scrolled to the bottom (as long as a user hasn’t scrolled back up). As ever, you could do this with JavaScript, as JavaScript can adjust scroll positions of elements. There is a way to do this primarily with CSS now that the anchor-overflow property exists, and I think it’s an extremely great CSS trick. There is another way though! Kitty Giraudel covers it in CSS-only bottom-anchored scrolling area. The base of the trick is quite simple and requires no additional elements. Y ..read more
Visit website
Chris’ Corner: Hard Things
CodePen Blog
by Chris Coyier
1w ago
Julia Evans has an extremely relatable and extremely charming talk in Making Hard Things Easy. Julia has a way of putting her finger on technology concepts that are notoriously difficult and making them easier to understand. She does this both by sharing her own tactics, like learning a reduced set of options or commands, as well as by producing very approachable guides. I like her formula: infrequent use + lots of gotchas = disaster. (As a CSS guy who regularly hears people complain about CSS, this tracks.) Another trick to avoiding that disaster is… using computers! Tools like linters can he ..read more
Visit website
Chris’ Corner: Real World CSS
CodePen Blog
by Chris Coyier
2w ago
I enjoyed Lee Robinson’s take on How I’m Writing CSS in 2024. Rather than jump right into tools and syntax, it starts with the user: What does a great experience look like loading stylesheets when visiting a website? Stylesheets should load as fast as possible (small file sizes) Stylesheets should not re-download unless changed (proper caching headers) The page content should have minimal or no layout shift Fonts should load as fast as possible and minimize layout shift Agreed! Number 3, and to some degree 4, are almost more in the JavaScript bucket than CSS, but it’s a good starter list ..read more
Visit website
Chris’ Corner: Cool Ideas
CodePen Blog
by Chris Coyier
3w ago
Lossy compression can be good. For something like a JPG, that naturally uses compression that can be adjusted, that compression leads to lost image data. In a good way. The image may end up being much smaller, which is good for performance. Sometimes the lost image data just isn’t a big deal, you barely notice it. You don’t often think of lossy compression outside of media assets though. You can certainly compress a text asset like CSS, but you wouldn’t want to do that with a lossy compression. It would probably break syntax! The code wouldn’t work correctly! It’s total madness! Unless you’re ..read more
Visit website
Chris’ Corner: Performance is Good for Brains
CodePen Blog
by Chris Coyier
1M ago
I was darn impressed by Scott Jehl’s personal charge to bring back an idea known as “responsive video”. If you’ve seen the <picture> element, and how you can provide multiple <source>s with different @media queries allowing for only the best match to be shown, you already get it. It turns out that browsers, at one time, sensibly thought that was a good idea and it made it to browsers, then it got ripped out for not-great reasons, and Scott wanted it back. Instead of just writing snarky blog posts like I would do, or using my best pretty please eyes on people I think could help, Sco ..read more
Visit website
Chris’ Corner: Some AdviCSS
CodePen Blog
by Chris Coyier
1M ago
Get it?! Like “advice”, but for CSS. When should you nest CSS? Scott Vandehey says: There’s a simple answer and a slightly more complicated answer. The simple answer is “avoid nesting.” The more practical, but also more complex answer is “nest pseudo-selectors, parent modifiers, media queries, and selectors that don’t work without nesting.” The big idea behind avoiding nesting (which is a native CSS feature now, if you hadn’t heard) is that it can lead to specificity increases that just aren’t necessary. Like: .card { .content { .byline { } } } That .byline selector probably d ..read more
Visit website
Chris’ Corner: Scroll Driven Delight
CodePen Blog
by Chris Coyier
1M ago
I’m pretty hot on Scroll-Driven Animations! What a wonderful idea that we can tie @keyframe animations timelines to scroll positions. And I’m sure the creators of it thought long and hard, because the API makes a ton of things possible. It’s not just “how far the entire page has scrolled”, although that’s possible. The progress through the animation can be tethered either to the scroll position of any element or to the position of an element within a scrollable container. Those are referred to as the Scroll Progress timeline or the View Progress timeline respectively. Slow clap, people. Bramus ..read more
Visit website
Chris’ Corner: People Be Doing Web Components
CodePen Blog
by Chris Coyier
2M ago
Native Web Components are still enjoying something of a moment lately. Lots of chatter, and a good amount of it positive. Other sentiment may be critical, but hopeful. Even more important, we’re seeing people actually use Web Components more and more. Like make them and share them proudly. Here are some recently: David Darnes made a <storage-form> component. Here’s an example that happens to me regularly enough that I really notice it. Have you ever been on GitHub, typing up a PR description or something, but then accidentally navigated away or closed the tab? Then you go back, and ever ..read more
Visit website
Chris’ Corner: More Like Celebrating Style Skills
CodePen Blog
by Chris Coyier
2M ago
It’s January and we’re seeing a little round of CSS wishlists make the rounds. Tyler Sticka is mostly hoping for better support on stuff that already is starting to cook, like View Transitions, anchor positioning, balanced text, and scroll-driven animations. But he’s got his own new wishes and has done the leg-work to properly propose them, like more useful vertical alignment (without extra work). Christopher Kirk-Nielsen also has some wishes for better support for thing that ought to be doing that naturally, like Style Queries, but also has some really interesting ideas of his own like using ..read more
Visit website
Chris’ Corner: Type
CodePen Blog
by Chris Coyier
2M ago
I’m in the mood for a typography focused edition. I have some links saved up I’ve been meaning to read. I’m going to start reading now and the links that turn out any good I’ll put below. Mike Mai put together a Typography Manual (for type on the web). It’s a pretty random spattering of 11 bits of advice. Originally a Pen! I can’t help but read through each of them and raise my Well, Actually finger, but I shall keep my finger down because more and more I like eliminating nuance in this industry. Just do this advice is pretty valuable. If you have no idea where to start, well, just follow the ..read more
Visit website

Follow CodePen Blog on FeedSpot

Continue with Google
Continue with Apple
OR