For the last few years my work-work has mostly focused on back end software (particularly around APIs). This meant that any front end work I was doing was for myself.
Being an long-in-the-tooth old dog, I tend to learn and trick, and roll it out again and again typically without taking the time to find whether I still need the trick. Case and point, I learnt about the JavaScript performance trick of ~~1.4 === 1 to floor a value (and the same float | 0) but really these days it's not "faster" than doing it the legible way (i.e. Math.floor(1.4)).
Given I've had a bit of time away from the backend, here's an unorganised list of things I've found I can use, and thusly remove extra code that I no longer need.
The list
- CSS:
text-underline-offset- the distance I can set the text-underline-offset: 12px - CSS:
gap- no more faffing with margins in flexbox. - CSS: nested media queries on selectors (and nesting general):
h1 {
font-size: 1rem;
@media (min-width: 600px) {
font-size: 2rem;
}
}
- CSS:
clamp(min, variable, max)- I used this extensively on FFConf 2025's css, the process of finding the right values is very much - CSS:
content: open-quotecan localised quotes and theqtag does this by default, via this neat insight from Stefan Judis - JS:
catchwithout catching the variable, let's me get past the'error' is defined but never used:
try {
doTheDodgyStuff();
} catch {
// nothing, it's fine
}
- JS: pointer events have improved (though still from experience they're not 100% perfect) but are to replace the old double click & touch handlers nonsense as seen in the W3C spec
- AVIF images are fully supported - I benefited from a train ride with Jake Archibald and in chatting I discovered AVIF are very well supported. This means easily getting 50% file size savings on JPEGs. I'm regularly running the avidenc command in directories:
ls *.jpg | xargs -P 8 -I {} avifenc -q 50 "{}" "{}".avif
So that's my little list.
Not even 10 things. I guess I've not learnt much yet, but even though I return to the server side of APIs in 2026, I'm sure I'll be kicking the tyres in the front again soon enough and adding to my measly list.
Originally published on Remy Sharp's b:log