Chris’ Corner: Real World CSS
CodePen Blog
by Chris Coyier
2d 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
1w 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
3w 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
1M 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
Chris’ Corner: Switch
CodePen Blog
by Chris Coyier
2M ago
The “switch” is a pretty common design pattern on the web. It’s pretty much a checkbox. In fact, under the HTML hood, it really ought to be an <input type="checkbox"> or perhaps a <select> with just two <option>s (or a third if there is an indeterminate state). But unfortunately, the web doesn’t give us any primitive that looks particularly switch-like, as in, some kind of knob that is flipped one way or the other. So we use CSS. For example, we hide the checkbox one way or another, making sure there is still a discoverable clickable area, then with the :checked selector, sty ..read more
Visit website
Chris’ Corner: Swinging For It
CodePen Blog
by Chris Coyier
2M ago
New year, new local code editor? It’s maybe worth a peak at Zed, at least. They do a good job in the one-sentence pitch: Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter. All tech things have to be fast, so check. No shade either, speed is vital in all things tech, especially something you use heavily all day. Their main competition is clearly VS Code, which already gets some flack for slowness (feels fast to me ?), so leaning into a comparison that shows them some 4x faster on startup is sensible marketing. “Multiplayer”… eh. I’m skepitcal about ..read more
Visit website

Follow CodePen Blog on FeedSpot

Continue with Google
Continue with Apple
OR