Search
The :focus-visible Trick
16.10.2020
Always worth repeating: all interactive elements should have a focus style. That way, a keyboard user can tell when they have moved focus to that element.
But if you use :focus alone for this, it has a side effect that a lot of people don’t like. It means that when you click (with a mouse)...
How to Conditionally Add Attributes to Objects
16.10.2020
JavaScript is full of tricks that you don’t know you want until you … want … them. Or maybe just until you see them. One trick I recently realized was conditionally adding attributes to React elements. Of course this trick essentially boils down to conditionally adding properties...
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...
How a Spoof Turned Into a Media Hype About Bitcoin Cash
19.9.2020
An anonymous Bitcoin Cash (BCH) supporter says he deliberately started a spoof which successfully baited local media to report on the coin. The trick, which involved the use of 100 Bitcoin Cash tip stickers, only cost a total of $1,100 yet it managed to get BCH featured by media outlets...
Winamp Skin Museum
15.9.2020
65,000 skins, they say. That’s extraordinary, especially considering how creative and well done many of them are. MySpace was an even bigger creative explosion of customization.
What’s the next product that will inspire this kind of user ownership through theming? Allowing...
Using max() for an inner-element max-width
7.9.2020
I go into all this in The “Inside” Problem. The gist: you want an edge-to-edge container, but the content inside to have a limited width. I think there is absolutely no problem using a nested element inside, but it’s also fun to look at the possibilities of making that work on...
Excluding Emojis From Transparent Text Clipping
2.9.2020
CSS-Tricks has this pretty cool way of styling hovered links. By default, the text is a fairly common blue. But hover of the links, and they’re filled with a linear gradient.
😍
Pretty neat, right? And the trick isn’t all that complicated. On hover…
give the link a linear...
More Control Over CSS Borders With background-image
7.8.2020
You can make a typical CSS border dashed or dotted. For example:
.box {
border: 1px dashed black;
border: 3px dotted red;
}
You don’t have all that much control over how big or long the dashes or gaps are. And you certainly can’t give the dashes slants, fading, or animation!...
The Cicada Principle, revisited with CSS variables
5.8.2020
Lea Verou digging up the CSS trickery classic and applying it to clip the backgrounds of some code blocks:
The main idea is simple: You write your main rule using CSS variables, and then use :nth-of-*() rules to set these variables to something different every N items. If you use enough...
The GitHub Profile Trick
28.7.2020
Monica Powell shared a really cool trick the other day:
The profile README is created by creating a new repository that’s the same name as your username. For example, my GitHub username is m0nica so I created a new repository with the name m0nica.
Now the README.md from that repo is essentially...
Position Vertical Scrollbars on Opposite Side with CSS
23.7.2020
Fair warning: I can’t say I recommend this in general because it breaks a very strong expectation of where scrollbars are, which are useful for a lots of folks, not to mention, a core accessibility feature for many.
But it is a fascinating CSS trick and the web is a big place with...
Memorize Scroll Position Across Page Loads
9.7.2020
Hakim El Hattab tweeted a really nice little UX enhancement for a static site that includes a scrollable sidebar of navigation.
???? If you've got a static site with a scrollable sidebar, it really helps to memorize the scroll position across page loads.
(left is default, right memorized)...
Quick Tips for High Contrast Mode
27.6.2020
Sarah Higley has some CSS tricks up her sleeve for dealing with High Contrast Mode on Windows, which I learned is referred to as WHCM.
Here’s the first trick:
[…] if the default CSS outline property doesn’t give you the visual effect you want [in WHCM] for focus states...
Line-Animated Hamburger Menu
26.6.2020
This kind of SVG + CSS animation trickery is catnip to me. Mikael Ainalem shares how to draw a hamburger icon (the “three lines” thing you’re well familiar with), but then animate it in a way that is surprising and fun by controlling the SVG properties in CSS.
CodePen Embed...
The Mad Magazine Fold-In Effect in CSS
25.6.2020
This was always my favorite thing in Mad magazine. One page (the inside of the back cover, I think) was covered in a zany illustration. You folded that page in thirds, covering up the middle-third of that image, and a new image would form because the illustration was designed to perfectly line...
Patternico
20.6.2020
I remember searching for tutorials for making seamless patterns in Photoshop¹ all the time back in the day.
It’s fun to see this little website for building repeating patterns as its one job. It does everything you’d expect: pick a background, drag some decorations onto it and position...
Phishing Sites Use Trick Letters in Domain Names to Steal XRP
16.6.2020
Experts from Xrplorer say that a fake XRP giveaway scam emerged in January 2020 and remains alive
Cool Little CSS Grid Tricks for Your Blog
10.6.2020
I discovered CSS about a decade ago while trying to modify the look of a blog I had created. Pretty soon, I was able to code cool things with more mathematical and, therefore, easier-to-understand features like transforms. However, other areas of CSS, such as layout, have remained a constant source...
The Trickery it Takes to Create eBook-Like Text Columns
8.6.2020
There’s some interesting CSS trickery in Jason Pamental’s latest Web Fonts & Typography News. Jason wanted to bring swipeable columns to his digital book experience on mobile. Which brings up an interesting question right away… how do you set full-width columns that...
Devising the Cloak of Invisibility in JavaScript
25.5.2020
Steganography. The art of hiding something right under your nose. For as long as humans have been alive, we’ve been trying to hide things — whether it’s our last slice of pizza or the location of a buried treasure. Do you remember the cool invisible lemon ink trick, where we’d write the secret...