Skip to main content
Fresh Article

CSS-Tricks Chronicle XXXVIII

Hey gang! I’ve been fortunate enough to be a guest in a variety of different here, so I thought it was time for another Chronicle post. You know, those special posts where I round up the random goings-on of things I do off of this site. … Read article “CSS-Tricks Chronicle XXXVIII”

Article

That’s Just How I Scroll

How do you know a page (or any element on that page) scrolls? Well, if it has a scrollbar, that’s a pretty good indication. You might still have to scrapple with your client about “the fold” or whatever, but I don’t think anyone is confused at what a scrollbar is or what it indicates.

But let’s say there is no scrollbar. That’s super common. macOS hides scrollbars by default and only shows them during scroll. Most mobile browsers don’t have … Read article “That’s Just How I Scroll”

Article

What I Learned by Fixing One Line of CSS in an Open Source Project

I was browsing the Svelte docs on my iPhone and came across a blaring UI bug. The notch in the in the REPL knob was totally out of whack. I’m always looking to contribute to open source, and I thought this would be a quick and easy fix. Turns out, there was a lot more to it than just changing one line of CSS. 

Replicating, debugging, setting up the local environment was interesting, difficult, and meaningful.… Read article “What I Learned by Fixing One Line of CSS in an Open Source Project”

Almanac

gap

The gap property in CSS is a shorthand for row-gap and column-gap, specifying the size of gutters, which is the space between rows and columns within grid, flex, and multi-column layouts.

/* Grid layout */
.container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: 1fr 2fr 1fr;
  gap: 30px 20px;
}

/* Flex layout */
.container {
  display: flex;
  gap: 10%;
}

/* Multi-column layout */
.container {
  column-count: 5;
  gap: 20px;
}
Read article “gap”
Article

Stacked Cards with Sticky Positioning and a Dash of Sass

The other day, I spotted this particularly lovely bit from Corey Ginnivan’s website where a collection of cards stack on top of one another as you scroll.… Read article “Stacked Cards with Sticky Positioning and a Dash of Sass”

Article

Chapter 2: Browsers

Previously in web history…

Sir Tim Berners-Lee creates the technologies behind the web — HTML, HTTP, and the URL which blend hypertext with the Internet — with a small team at CERN. He convinces the higher-ups in the organizations to put the web in the public domain so anyone can use it.

Dennis Ritchie had a problem.

He was working on a new, world class operating system. He and a few other colleagues were building it from the ground up … Read article “Chapter 2: Browsers”

Article

Practical Use Cases for JavaScript’s closest() Method

Have you ever had the problem of finding the parent of a DOM node in JavaScript, but aren’t sure how many levels you have to traverse up to get to it? Let’s look at this HTML for instance:

<div data-id="123"<buttonClick me</button</div

That’s pretty straightforward, right? Say you want to get the value of data-id after a user clicks the button:

var button = document.querySelector("button");


button.addEventListener("click", (evt) ={
  console.log(evt.target.parentNode.dataset.id);
  // prints "123"
});

In this very case, … Read article “Practical Use Cases for JavaScript’s closest() Method”

Article

Halfmoon: A Bootstrap Alternative with Dark Mode Built In

I recently launched the first production version of Halfmoon, a front-end framework that I have been building for the last few months. This is a short introductory post about what the framework is, and why I decided to build it.… Read article “Halfmoon: A Bootstrap Alternative with Dark Mode Built In”

Sponsored Link

Register for An Event Apart’s Front-End Focus Online Conference

An Event Apart has been doing these single-day online “Online together” conferences. You can check out the last couple, which are available on-demand (buy it, watch it when you want) for a limited time:

The next event is one that anyone reading CSS-Tricks will really want to check out. It’s called “Front-End Focus” which is literally what we write about here all the time. Register today Read article “Register for An Event Apart’s Front-End Focus Online Conference”

Video

#191: Learn by doing: CUBE CSS

Andy Bell joins me to talk through his CSS methodology he calls CUBE CSS. That’s Composition, Utility, Block, and Exception.… Read article “#191: Learn by doing: CUBE CSS”

Link

System UIcons

Keep browsing in the archives

Monthly Mixup

Article

A CSS Golfing Exercise

Article

A Funny Thing Happened on the Way to Learning JavaScript

Article

Making My Netlify Build Run Sass

Snippet

Strip HTML Tags in JavaScript

Monthly Sponsor
Thanks, Frontend Masters!