Search
proxy-www
24.5.2021
I like a good trick. What if… a URL was… a promise… that fetched said URL?
www.codepen.io.then((response) ={
console.log(response);
});
That’s what @justjavac did with JavaScript Proxys. A clever trick, that. Don’t @ me about the practicality. Trick…
The post...
Creating Stylesheet Feature Flags With Sass !default
14.5.2021
!default is a Sass flag that indicates conditional assignment to a variable — it assigns a value only if the variable was previously undefined or null. Consider this code snippet:
$variable: 'test' !default;
To the Sass compiler, this line …
The post Creating Stylesheet Feature Flags With...
Not Your Typical Horizontal Rules
16.4.2021
The default browser style for <hr> is so weird. It’s basically:
border-style: inset;
border-width: 1px;
The default border-color is black, but the border doesn’t actually look black, because the inset border “adds a split tone to the line …
The post Not Your Typical...
The `ping` attribute on anchor links
8.4.2021
I didn’t know this was a thing until Stefan Judis’s post:
<a href="https://www.stefanjudis.com/popular-posts/"
ping="https://www.stefanjudis.com/tracking/"Read popular posts</a
You give an anchor link a URL via a ping attribute, and the browser will hit that URL with a...
Too Many SVGs Clogging Up Your Markup? Try `use`.
10.3.2021
Recently, I had to make a web page displaying a bunch of SVG graphs for an analytics dashboard. I used a bunch of <rect>, <line> and <text> elements on each graph to visualize certain metrics.
This works and renders …
The post Too Many SVGs Clogging Up Your Markup?...
To the brain, reading computer code is not the same as reading language
22.2.2021
One of the things I do when teaching beginning front-end development is ask students to describe what it’s like to read HTML. I give them pretty basic markup for a long-form article, and ask them to read it twice: first …
The post To the brain, reading computer code is not the same...
Use CSS Clamp to create a more flexible wrapper utility
17.2.2021
I like Andy’s idea here:
.wrapper {
width: clamp(16rem, 90vw, 70rem);
margin-left: auto;
margin-right: auto;
padding-left: 1.5rem;
padding-right: 1.5rem;
}
Normally I’d just set a max-width there, but as Andy says:
This becomes a slight issue in mid-sized viewports, such...
How to Favicon in 2021
10.2.2021
I always appreciate someone looking into and re-evaluating the best practices of something that literally every website needs and has a complex set of requirements. Andrey Sitnik has done that here with favicons.
The final suggestion:
<link rel="icon" href="/favicon.ico"
…
The post...
Animating a CSS Gradient Border
8.2.2021
This little trick for gradient borders is super useful:
.border-gradient {
border: 5px solid;
border-image-slice: 1;
border-image-source: linear-gradient(to left, #743ad5, #d53a9d);
}
Here’s some basic demos from our article on the subject. Sephanie Eckles was sharing around the idea...
You want minmax(10px, 1fr) not 1fr
22.1.2021
There are a lot of grids on the web like this:
.grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
}
My message is that what they really should be is:
.grid {
display: grid;
grid-template-columns: repeat(3, minmax(10px, 1fr));
}
Why? In …
The post You want minmax(10px, 1fr)...
Dynamic, Conditional Imports
13.1.2021
With ES Modules, you can natively import other JavaScript. Like confetti, duh:
import confetti from 'https://cdn.skypack.dev/canvas-confetti';
confetti();
That import statement is just gonna run. There is a pattern to do it conditionally though. It’s like this:
(async ()
…
The post...
A Utility Class for Covering Elements
26.12.2020
Big ol’ same to Michelle Barker here:
Here’s something I find myself needing to do again and again in CSS: completely covering one element with another. It’s the same CSS every time: the first element (the one that needs to be covered) has position: relative applied to it....
Responsible, Conditional Loading
25.12.2020
Over on the Polyplane blog (there’s no byline but presumably it’s Kilian Valkhof), there is a great article, Creating websites with prefers-reduced-data, about the prefers-reduced-data media query. No browser support yet, but eventually you can use it in CSS to make choices that reduce...
Late to Logical
7.12.2020
2020 brought another wave of logical property features to major browsers and I’ve thoroughly enjoyed my investment into logical, rather than physical, web styling. I feel like I’ve learned a new way to speak about the box model that results in less written code with more global coverage.
p {
...
How to create a client-serverless Jamstack app using Netlify, Gatsby and Fauna
3.12.2020
The Jamstack is a modern web development architecture based on client-side JavaScript, reusable APIs, and prebuilt Markup.
The key aspects of a Jamstack application are the following:
The entire app runs on a CDN (or ADN). CDN stands for Content Delivery Network and an ADN is an Application...
Lots of Ways to Use Math.random() in JavaScript
30.11.2020
Math.random() is an API in JavaScript. It is a function that gives you a random number. The number returned will be between 0 (inclusive, as in, it’s possible for an actual 0 to be returned) and 1 (exclusive, as in, it’s not possible for an actual 1 to be returned).
Math.random(); // returns...
Use a Submit Button Outside of !
24.11.2020
Have you ever felt like you’ve been a professional developer or designer forever, and somehow not known something basic, and borderline hate yourself? That’s me with a trick that was introduced to me by Miguel Piedrafita: 🔥 You can submit forms from a button outside of the form...
console.log({ myVariable });
19.11.2020
I think this might be my most popular tweet of all time, but I’m not sure how to verify that these days. I’ll restate this neat little trick here because blogging is cool and fun.
I used to do this a lot while debugging JavaScript:
console.log("myVariable: ", myVariable);
But now I...
Copyediting with Semantic HTML
17.11.2020
Tracking changes is a quintessential copyediting feature for comparing versions of content. While we’re used to tracking changes in a word processing document, we actually have HTML elements capable of that. There are a lot of elements that we can use for this process. The main ones we’ll look...
Understanding flex-grow, flex-shrink, and flex-basis
11.11.2020
When you apply a CSS property to an element, there’s lots of things going on under the hood. For example, let’s say we have some HTML like this:
<div class="parent"<div class="child"Child</div<div class="child"Child</div<div class="child"Child</div</div
And...