Published at
Updated at
Reading time
8min
The Web Weekly newsletter keeps you up to date, teaches you web development tricks and covers all things working in tech.

Guten Tag! Guten Tag! πŸ‘‹

Have you heard of width: stretch? Do you include baseline widgets on your blog? And do you optimize your sites' network waterfall with fetchpriority?

Turn on the Web Weekly tune and find the usual web dev goodness below. Enjoy!

Christopher listens to "Flume - SKY SKY 1.3"

I love the typical Flume style and the beginning of the singing which makes me always smile. It never fails to make me happy!

Do you want to share your favorite song with the Web Weekly community? Hit reply; there is only one more song left in the queue. 😱

Do you use CSS resets? I admit I'm usually just YOLO'ing it because the inconsistencies across browsers aren't so bad these days. But two CSS reset posts this week taught me some things.

First, here's Mayank advocating for using a @layer reset {}.

When you place any styles inside a layer, these styles automatically have lower priority compared to all unlayered styles on the page. Think of it like an !unimportant block. You don’t need to worry about specificity or order of stylesheets at all.

I'm not entirely sold on @layer, but I wasn't aware that layered styles have lower specificity than unlayered styles.

And second, here's Jake's take on the matter.

:not(\[class\]) {   h1&, h2&, h3&, h4&, h5&, h6& {     margin-block: 0.75em;     line-height: 1.25;     text-wrap: balance;     letter-spacing: -0.05ch;   } }

This post includes the usual styling preferences (everything's also included in a @reset layer). But look at this. πŸ‘† This is a smart way of resetting styles. Jake uses native CSS nesting, :not and the attribute selector to only apply reset styles to elements without a defined class. It's like a conditional CSS reset. 🀯

Do you reset your CSS? Do you have favorite ways of doing things? If so, let me know; maybe I'll reconsider adopting CSS resets.

Something that made me smile this week

PacMan game with a webcam picture showing two people in the background.

What if I told you you can play Pacman with your face? Well… Nolan built just that and explains how he created it.

Go and play!

New on the blog

Do you use the new AI editor in town?

Whether I'll be using Cursor in a few years, I can't tell.I am confident that at the time of writing this, Cursor is the best example of the potential of LLM coding assistants. If you want to explore how this tool's valuevalue I suggest you give it a spin.

I'm still a somewhat "happy" Copilot user. I don't rely on it too much and treat it like a good but drunk friend. Sometimes lovely, sometimes helpful, and sometimes talking absolute nonsense.

Many people around me use Cursor these days. And while I'll remain skeptical, Tom shared his experience, and I might try Cursor very soon.

Code with an LLM

New and already supported CSS

Amazing CSS in 2024

If you're a Web Weekly regular, you've probably seen most of the things included in Adam's slide deck, but it's still a fantastic overview of what's possible in CSS these days.

Be amazed by CSS

A valid take on the Masonry discussion

grid-template-rows: masonry vs display: masonry

Two weeks ago, I shared the discussion about the competing masonry standards (grid-template-rows: masonry vs display: masonry). This week, Ahmad shared some valid arguments for making the new layout part of CSS grid by comparing both approaches in practice.

Make up your mind about masonry

When and where should you register your custom elements?

// Check if `?define` is set and if so, define it in the default registry if (new URL(import.meta.url).searchParams.has("define")) { 	customElements.define("bleh-bleh-bleh", BlehBlehBlehElement); }

When you're betting on custom elements, there's always the question of where to call customElements.define(). Should the script with your element class do it? Should you register the component after loading the class?

Why not both? Nathan shared a smart idea to make the registering flexible.

Register!

This post reminded me of Mayank's approach of including a static register method in your HTMLElement class. Also smart!

You're halfway through!

Wowza! Would you enjoy getting Web Weekly straight to your inbox?

The wonderful weird web – play2048

A game preview showing a grid of numbered tiles.

Let's pretend I didn't spend a few hours on Sunday to beat my own record playing this game, okay? πŸ˜…

Don't play for too long

width: stretch

width: -webkit-fill-available; width: -moz-available; width: stretch;

Oliver shared a display property I haven't seen before β€” width: stretch. The stretch value sets an element's width to its margin box. Did you ever try to style a button full-width to end up doing calc(100% - 20px) (or similar)? stretch does this for you. It stretches the element to the full width minus the applied margin.

Stretch it

I'm amazed but also confused by this; you can expect a follow up post hopefully next week.

CSS-only fit text

Example showing how text resizes depending on the character width

Roman's writing is one of my absolute favorites because his posts often include so much CSS magic that I'm blown away. Chris commented on a post I've open for five months now that describes how to make your browser automagically set a fitting font size just with CSS (Chromium-only).

If you want to learn the nitty-gritty details, head to Roman's blog. It's full of next-level CSS nerdiness.

Make your text fit

Oh and btw, I updated my blogroll. If you have an RSS feed to follow I'd love to put your blog in my reading rotation.

box-decoration-break

Demo of box-decoration-break clone and slice

With Chrome 130, box-decoration-break: clone made it into cross-browser territory. This post is for you if you're cursing styles that are cut off when an inline element spans multiple lines.

Style the breaks

New on the baseline: fetchpriority

HTML carousel with elements that have different fetchpriorities applied.

There was also a new Firefox release, and the fetchpriority HTML attribute made it into the baseline. But before you slap fetchpriority="high" on everything, make sure to know how it works.

Optimize your loading

Random MDN – popover

popover β€” The popover global attribute is used to designate an element as a popover element.

From the unlimited MDN knowledge archive...

I'm currently rebuilding the Web Weekly landing page and used popover for the first time. It's nothing but wonderful to define UI interactions right in HTML.

Pop over!

And if you're learning about popovers, make sure to check Hidde's post on dialogs and popovers. It's long but worth it.

TIL recap – sparse JavaScript arrays

let numbers = \[ 1, 2, 3, 4 \]; delete numbers\[ 1 \];  numbers.forEach((value, index) => console.log(value, index)); // 1, 0 // 3, 2 // 4, 3

Did you know that JavaScript arrays can have holes? If not, you can find more about this JS quirk on the blog.

Don't put holes in your arrays

Find more short web development learnings in my "Today I learned" section.

Three valuable projects to have a look at

A new Tiny Helper

Coding font preview showing two fonts to choose from.

If you're ready for a new monospace font, "Coding Font" shows you multiple fonts side-by-side. Choose left, right, left, left… and your new favorite will be in front of you.

Discover your favorite coding font

Find more single-purpose online tools on tiny-helpers.dev.

Thought of the week

I plugged the XOXO talks last week, and here's a wonderful quote from Molly White's "Web3 Is Going Just Great" talk.

The web is the people who use it.

Do you enjoy Web Weekly? | Did you learn something from this issue?

πŸ’™ If so, maybe you want to share it with your friends on your favorite social network. Web Weekly is at 5.4k subscribers right now and reaching 6k would be the perfect Christmas gift for me. 😊

This is all, friends!

Loved this email? Hated this email? I want to hear about it!

If you think something needs improvement or something sparked some joy, reply to this email because I want to know more!

And with that, take care of yourself - mentally, physically, and emotionally.

I'll see you next week! πŸ‘‹

If you enjoyed this article...

Join 5.5k readers and learn something new every week with Web Weekly.

Web Weekly β€” Your friendly Web Dev newsletter
Reply to this post and share your thoughts via good old email.
Stefan standing in the park in front of a green background

About Stefan Judis

Frontend nerd with over ten years of experience, freelance dev, "Today I Learned" blogger, conference speaker, and Open Source maintainer.

Related Topics

Related Articles