I just purchased Josh Comeau’s new course, Whimsical Animations. The course page itself has some delightful animations.
PS: I also discovered Gochi Hand, a cute handwritten font, on the course page.
I just purchased Josh Comeau’s new course, Whimsical Animations. The course page itself has some delightful animations.
PS: I also discovered Gochi Hand, a cute handwritten font, on the course page.
John Oliver on drawing the line:
Giving the bully your lunch money doesn’t make him go away. It just makes him come back hungrier each time.
I really like this explanation of what happens in between the user entering a web address into the browser and the browser displaying the result.
Just like a word document can be displayed in a word processing application, a web page is simply an HTML document that can be displayed in a web browser. The only difference is that a web page can embed a variety of different types of resources such as styles, fonts, images, scripts, and so on.
Stupid #CSS question because I’m losing my mind here: why isn’t calc(.5*a) working? What am I missing? It doesn’t seem to be working in any browser.
Ana is trying to use calc(.5 * a) as a part of the relative color syntax, presumably to create semi transparent outlines. But it is not working because calc(.5 * a) is an invalid property value. As Valtteri Laitinen replied, it should actually be alpha in there instead of a.
.class {
outline-color: rgb(from currentcolor r g b / calc(0.5 * a)); /* ❌ invalid */
outline-color: rgb(
from currentcolor r g b / calc(0.5 * alpha)
); /* ✅ valid */
}I re-read Heydon Pickering’s post on the HTML article element in the middle of writing the markup for a new website.
Heydon’s writing is so sharp and funny. Unmistakably theirs. No one else writes quite like them, and I’m here for it.
I was reading Manuel Matuzovic’s article on meta theme color and came across this snippet:
<style>
:root {
--theme: blue;
}
</style>
<meta name="theme-color" content="var(--theme)" />I wish it was possible to access custom properties outside the <style> tag in the <head>. It would keep things DRY.
In JavaScript, things get interesting when you need to sort strings that contain numbers in a way that matches human expectations.
const files = ['IMG_2.png', 'IMG_1.png', 'IMG_10.png', 'IMG_20.png'];
files.sort();
// Output: ['IMG_1.png', 'IMG_10.png', 'IMG_2.png', 'IMG_20.png']This happens because, by default, when no compare function is provided, JavaScript’s array sort() method converts the elements into strings, then compares their sequences of UTF-16 code unit values.
This behaviour is well documented on MDN.
So, how do we sort arrays like the ones above in a more accurate, human-friendly order?
This is where the compare() method of the Intl.Collator API with the numeric: true option shines. It provides the natural sorting behaviour that correctly handles numbers alongside other characters.
When numeric: true is set, the collator detects numeric substrings inside the strings and parses those substrings as actual numbers, not as sequences of digits. And then it compares the numbers numerically, not character by character.
const naturalOrder = new Intl.Collator(undefined, {
numeric: true,
}).compare;
const files = ['IMG_2.png', 'IMG_1.png', 'IMG_10.png', 'IMG_20.png'];
files.sort((a, b) => naturalOrder(a, b));
// Output: ['IMG_1.png', 'IMG_2.png', 'IMG_10.png', 'IMG_20.png']Hat tip to Jan Miksovsky, whose zero dependencies SSG project led me to discover this.
Jim Nielsen on the personal connections formed on the internet.
You could search the world and find someone who saw what you see, felt what you feel, went through what you’re going through.
And how these connections are increasingly being lost when we prompt an impersonal LLM instead.
Today I learned, grid-auto-columns and grid-auto-rows size implicit tracks as well as any explicit tracks that are not explicitly sized by by grid-template-rows or grid-template-columns.
Until now, I was under the impression that grid-auto-rows and grid-auto-columns size only implicit grid tracks.
The grid-row grid-placement property is shorthand for grid-row-start and grid-row-end.
.grid-item {
grid-row: 1/-1;
/* is equivalent to */
grid-row-start: 1;
grid-row-end: -1;
}In the above declaration, we use integers to position and size the grid item by line numbers.
As per the spec:
Numeric indexes in the grid-placement properties count from the edges of the explicit grid. Positive indexes count from the start side (starting from 1 for the start-most explicit line), while negative indexes count from the end side (starting from -1 for the end-most explicit line).
The important bit is the explicit grid. This begs the question …
As per the spec:
The three properties
grid-template-rows,grid-template-columns, andgrid-template-areastogether define the explicit grid of a grid container by specifying its explicit grid tracks.
Simply put, the explicit grid consists of manually defined rows and columns.
The size of the explicit grid is determined by the larger of the number of rows/columns defined by
grid-template-areasand the number of rows/columns sized bygrid-template-rows/grid-template-columns. Any rows/columns defined bygrid-template-areasbut not sized bygrid-template-rows/grid-template-columnstake their size from thegrid-auto-rows/grid-auto-columnsproperties. If these properties don’t define any explicit tracks the explicit grid still contains one grid line in each axis.
That last bit is what leads to line -1 being the same line as 1 because the explicit grid still contains one grid line in each axis.
As Manuel Matuzovic puts it:
If there are more grid items than cells in the grid or when a grid item is placed outside of the explicit grid, the grid container automatically generates grid tracks by adding grid lines to the grid. The explicit grid together with these additional implicit tracks and lines forms the so called implicit grid.
Paraphrasing Jen Simmons:
grid-row: 1/-1 will work as expectedI love this bit from the video where Jason quotes Enrique Peñalosa, the former mayor of Bogotá, Colombia:
A developed country is not where the poor have cars. It’s where the rich use public transportation.
But why is it important that wealthy people take public transportation? Because, as Jason mentions,
[…] for better or for worse, these people are likely to have the power and political influence to demand efficient service.
Karthik Srinivasan discusses how to use curation to build a personal brand and shares some steps to get started.
Karthik Srinivasan uses his experience with running as an analogy to emphasize the importance of consistently showing up in the context of personal branding.
I found the analogy effective and relatable, as I had a similar experience when I started running.
Jim Nielsen uses his experience with golf as a metaphor to explain that the key to success in web development comes from actual practice — building websites — rather than obsessing over what tools, frameworks and technologies others are using.
Personal branding is about bringing focus to your touchpoints with the world (of strangers) so that the right kinds of people can find you and remember you. You make use of the attention when you really need it. But it is good to be in the consideration set.
As a freelancer, I’m always eager to learn how other folks work. Piccalilli’s behind-the-scenes look at their redesign is extremely useful.
Dr. Steve Bagley explains in layman’s terms what an operating system is:
[…] Imagine the difference between a house and a hotel. If you own a house, you can decide how to use the rooms, what color to paint the walls. But if that house becomes a hotel, you might give people the option to change the air conditioning temperature, but you wouldn’t let them fit air conditioning into their room without permission from the building owner. And it’s a bit the same with a computer. The operating system is a bit like the people who run the hotel in that it’s controlling all the resources for the system. So if Microsoft Word crashes, these days it’s not going to take down your computer because the operating system is set up in such a way that it can access resources that have been assigned to it and clean that up, and everything else continues hunky-dory.
And what happens if the operating system crashes and you get the blue screen of death (BSoD):
At that point, the thing that’s in charge of controlling everything has gone wrong, is corrupted, and can no longer run. So there’s pretty much no option at that point other than to halt the machine, say something’s gone wrong, and let the user reboot and restart.
I got the opportunity to proofread Ahmad Shadeed’s latest article on CSS Grid Areas before its release. It inspired me to refactor the code on my site to use grid-template-areas.
Wow! Who knew you could use modern CSS to test HTML? Well, Heydon certainly did!