The click event is quite simple and easy to use; you listen for the event and run code when the event is fired. It works on just about every HTML element there is, a core feature of the DOM API.
As often the case with the DOM and JavaScript, there are nuances to consider. Some nuances with the click event are typically...
Wednesday, June 30, 2021
undefined
202
I was working on a bug ticket the other day where it was reported that an icon was sitting low in a button. Just not aligned like it should be. I had to go on a little journey to figure out how to replicate it before I could fix it. Lemme set the scene.
Here’s the screenshot:
See how the icon is just… riding low?
But...
undefined
202
I use this line, or one like it, in a lot of quick demos. Not that it’s not a production-worthy line of code—I just tend to be a bit more explicit on bigger projects.
html {
font: 110%/1.4 system-ui;
}
Someone wrote in confused by it, and I could see how a line like that is a bit bewildering at first.
The first thing...
undefined
202
Delan Azabani digs into the (hopefully) coming soon ::spelling-error and ::grammar-error pseudo selectors in CSS. Design control is always nice. Hey, if we can style scrollbars and style selected text, why not this?
The squiggly lines that indicate possible spelling or grammar errors have been a staple...
Tuesday, June 29, 2021
undefined
202
I needed to select some elements between two fixed indexes the other day — like literally the second through fifth elements. Ironically, I have a whole post on “Useful :nth-child Recipes” but this wasn’t one of them.
The answer, it turns out, isn’t that complicated. But it did twist my brain a little bit.
Say you want...
undefined
202
I think we’re all largely aware of named colors in CSS:
color: OldLace;
background: rebeccapurple;
I guess you’d just call those “named colors” in CSS.
Those aren’t the only kind of named colors there are though. Some of them are a bit more fluid. Jim Nielsen was blowin’ minds the other day when he blogged about System...
Sara digs into a bug I happened to have mentioned back in 2012 where fluid type didn’t resize when the browser window resized. Back then, it affected Chrome 20 and Safari 6, but the bug still persists today in Safari when a calc() involves viewport units.
Sara credits Martin Auswöger for a super weird and clever trick...
undefined
202
To make some terminology clear here:
CMS = Content Management System
CRM = Customer Relationship Management
Both are essentially database-backed systems for managing data. HubSpot is both, and much more. Where a CMS might be very focused on content and the metadata around making content useful, a CRM is focused on leads...
Monday, June 28, 2021
undefined
202
Not news to any web developer in 2021: CSS Grid is an incredibly powerful tool for creating complex, distinct two-dimensional modern web layouts.
Recently, I have been experimenting with CSS Grid and alignment properties to create component layouts that contain multiple overlapping elements. These layouts could be styled...
Saturday, June 26, 2021
undefined
202
I am part of that 82% that got it wrong in Lea’s quiz (tweet version).
Here’s the code:
:root {
--accent-color: skyblue;
}
div {
--accent-color: revert;
background: var(--accent-color, orange);
}
So what background do I expect <div> to have?
My brain goes like this:
Well, --accent-color is declared, so...
Friday, June 25, 2021
undefined
202
I recently had to create a widget in React that fetches data from multiple API endpoints. As the user clicks around, new data is fetched and marshalled into the UI. But it caused some problems.
One problem quickly became evident: if the user clicked around fast enough, as previous network requests got resolved, the UI...