Search
How to Load Fonts in a Way That Fights FOUT and Makes Lighthouse Happy
24.11.2020
A web font workflow is simple, right? Choose a few nice-looking web-ready fonts, get the HTML or CSS code snippet, plop it in the project, and check if they display properly. People do this with Google Fonts a zillion times a day, dropping its <link> tag into the <head>.
Let’s...
A Dynamically-Sized Sticky Sidebar with HTML and CSS
20.11.2020
Creating page content that sticks to the viewport as you scroll, something like a jump-to-anchor menu or section headings, has never been easier. Throw a position: sticky into your CSS ruleset, set the directional offset (e.g. top: 0) and you’re ready to impress your teammates with minimal effort....
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...
Parsing Markdown into an Automated Table of Contents
13.11.2020
A table of contents is a list of links that allows you to quickly jump to specific sections of content on the same page. It benefits long-form content because it shows the user a handy overview of what content there is with a convenient way to get there.
This tutorial will show you how to parse...
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...
Netlify Background Functions
10.11.2020
As quickly as I can:
AWS Lambda is great: it allows you to run server-side code without really running a server. This is what “serverless” largely means.
Netlify Functions run on AWS Lambda and make them way easier to use. For example, you just chuck some scripts into a folder they...
How to Animate the Details Element Using WAAPI
5.11.2020
Animating accordions in JavaScript has been one of the most asked animations on websites. Fun fact: jQuery’s slideDown() function was already available in the first version in 2011.
In this article, we will see how you can animate the native <details> element using the Web Animations...
How to Write Loops with Preprocessors
5.11.2020
Loops are one of those features that you don’t need every day. But when you do, it’s awfully nice that preprocessors can do it because native HTML and CSS cannot.
Sass (SCSS)
for Loop
CodePen Embed Fallback
while Loop
CodePen Embed Fallback
each Loop
CodePen Embed Fallback
Less
for...
This page is a truly naked, brutalist html quine.
4.11.2020
Here’s a fun page coming from secretGeek.net. You don’t normally think “fun” with brutalist minimalism but the CSS trickery that makes it work on this page is certainly that.
The HTML is literally displayed on the page as tags. So, in a sense, the HTML is both the page...
GIFS and prefers-reduced-motion
3.11.2020
The <picture> element has a trick it can do where it shows different image formats in different situations. If all you are interested in is formats for the sake of performance, maybe you’d do:
<picture<source srcset="img/waterfall.avif" type="image/avif"<source...
In Defense of Tables and Floats in Modern Day Development
30.10.2020
Twenty-plus years ago, tables were the main way web pages were created in HTML. It gave web builders consistent control of constructing pages with some “design.” No longer did sites only have to be top-to-bottom in a linear manner — they could be set up with columns that align left-to-right...
xm
21.10.2020
This is a neat little HTML preprocessor from Giuseppe Gurgone. It has very few features, but one of them is HTML includes, which is something I continue to be baffled that HTML doesn’t support natively. There are loads of ways to handle it. I think it’s silly that it’s been...
Smarter Ways to Generate a Deep Nested HTML Structure
21.10.2020
Let’s say we want to have the following HTML structure:
<div class='boo'<div class='boo'<div class='boo'<div class='boo'<div class='boo'</div</div</div</div</div
That’s real a pain to write manually. And the reason why this post was born was being...
Layoutit Grid: Learning CSS Grid Visually With a Generator
15.10.2020
Layoutit Grid is an interactive open source CSS Grid generator. It lets you draw your designs and see the code as you go. You can interact with the code, add or remove track lines and drag them around to change the sizing — and you get to see the CSS and HTML change in real time!
Add some tracks...
How to Recreate the Ripple Effect of Material Design Buttons
12.10.2020
When I first discovered Material Design, I was particularly inspired by its button component. It uses a ripple effect to give users feedback in a simple, elegant way.
How does this effect work? Material Design’s buttons don’t just sport a neat ripple animation, but the animation also...
Coding the Mouse Particle Effect from Mark Appleby’s Website
12.10.2020
Learn how to create the mouse particle effect from Mark Appleby's website in this ALL YOUR HTML episode.
The post Coding the Mouse Particle Effect from Mark Appleby’s Website appeared first on Codrops
Balancing on a pivot with Flexbox
8.10.2020
Let me show you a way I recently discovered to center a bunch of elements around what I call the pivot. I promise you that funky HTML is out of the question and you won’t need to know any bleeding-edge CSS to get the job done.
I’m big on word games, so I recently re-imagined the main menu...
Styling Complex Labels
5.10.2020
Danielle Romo covers the HTML pattern you need when you have a wordy <label> with fancy styling for an <input type="radio">.
The trick? The ol’ <span class="hidden-visually"> that contains the label that you want to be read, and a <span aria-hidden="true"> with...
Recreating the “100 Days of Poetry” Effect with Shader, ScrollTrigger and CSS Grid
5.10.2020
The latest ALL YOUR HTML live coding session where you'll learn how to recreate the effect seen on the "100 Days of Poetry" website.
The post Recreating the “100 Days of Poetry” Effect with Shader, ScrollTrigger and CSS Grid appeared first on Codrops
Web Technologies and Syntax
24.9.2020
JavaScript has a (newish) feature called optional chaining. Say I have code like:
const name = Data.person.name;
If person happens to not exist on Data, I’m going to get a hard, show-stopping error. With optional chaining, I can write:
const name = Data.person?.name;
Now if person...