Search
Color Mixing With Animation Composition
24.9.2024
Mixing colors in CSS is pretty much a solved deal, thanks to the more recent color-mix() function as it gains support. Pass in two color values — any two color values at all — and optionally set the proportions.
background-color:
…
Color Mixing With Animation Composition originally...
Paragraphs
30.8.2024
I sure do love little reminders about HTML semantics, particularly semantics that are tougher to commit to memory. Scott has a great one, beginning with this markup:
<pI am a paragraph.</p<spanI am also a paragraph.</span<div
…
Paragraphs originally published...
HTML Attribute to Allow/Disallow Handwriting Input
12.8.2024
A new explainer for a new HTML attribute to handle handwritten inputs. Like this:
<input type="text" handwriting="true" ... <input type="text" handwriting="false" ... <textarea handwriting="" ... <!-- evaluates to "true" --<div contenteditable...
HTML Web Components Make Progressive Enhancement and CSS Encapsulation Easier!
1.8.2024
I have to thank Jeremy Keith and his wonderfully insightful article from late last year that introduced me to the concept of HTML Web Components. This was the “a-ha!” moment for me:
When you wrap some existing markup in a
…
HTML Web Components Make Progressive Enhancement and...
Ahead Of The Game: Where Does Games Media Go From Here?
31.10.2023
Read more
The Double Emphasis Thing
6.2.2023
I used to have this boss who loved, loved, loved, loved to emphasize words. This was way back before we used a WYSIWYG editors and I’d have to handcode that crap.
<pI used to have this
…
The Double Emphasis Thing originally published on CSS-Tricks, which is part of...
CSS Infinite 3D Sliders
16.12.2022
In this series, we’ve been making image sliders with nothing but HTML and CSS. The idea is that we can use the same markup but different CSS to get wildly different results, no matter how many images we toss …
CSS Infinite 3D Sliders originally published on CSS-Tricks, which is part of...
Unchain My Inaccessibly-Labelled Heart
14.12.2022
Suzy Naschansky from the HTMHell Advent Calendar:
<h2 id="article1-heading"All About Dragons</h2<pI like dragons. Blah blah blah blah blah.</p<p<a id="article1-read-more" aria-labelledby="article1-read-more article1-heading"Read more</a</p
See that aria-labelledby...
Manuel Matuzovic: max() Trickery
18.10.2022
By way of a post by Manuel Matuzović which is by way of a demo by Temani Afif.
.wrapper {
margin-inline: max(0px, ((100% - 64rem) / 2));
}
You’d be doing yourself a favor to read Manuel’s breakdown of …
Manuel Matuzovic: max() Trickery originally published on CSS-Tricks, which...
Interpolating Numeric CSS Variables
30.8.2022
We can make variables in CSS pretty easily:
:root {
--scale: 1;
}
And we can declare them on any element:
.thing {
transform: scale(--scale);
}
Even better for an example like this is applying the variable on a user …
Interpolating Numeric CSS Variables originally published...
How to Copy HTML and CSS Code From Websites Easily
2.8.2022
Learn how to use CSS Scan to easily copy styles and markup of any element on a website
How stroke-dasharray Patterns Work
15.7.2022
Say you have a line in SVG:
<svg<line x1="0" y1="30" x2="500" y2="30" stroke-color="#f8a100" /</svg
You can use the stroke-dasharray property in CSS to make dashes:
line {
stroke-dasharray: 5;
}
That 5 value is a relative unit based …
How stroke-dasharray Patterns...
Please Give Me Some Space
3.6.2022
There’s all kinds of ways to do that. Some more advisable and better-suited for certain situations than others, of course.
We could do it directly in HTML:
<pWe go from one line...<br<brdown a couple more.</p
But that’s …
Please Give Me Some Space originally...
Trailing Slashes on URLs: Contentious or Settled?
25.2.2022
A fun deep dive from Zach. Do you have an opinion on which you should use?
1) https://website.com/foo/
2) https://websites.com/foo
The first option has a “trailing slash.” The second does not.
I’ve always preferred this thinking: you use a trailing …
Trailing Slashes...
Multi-Value CSS Properties With Optional Custom Property Values
11.2.2022
Imagine you have an element with a multi-value CSS property, such as transform: optional custom property values:
.el {
transform: translate(100px) scale(1.5) skew(5deg);
}
Now imagine you don’t always want all the transform values to be applied, so some …
Multi-Value CSS Properties With...
No Motion Isn’t Always prefers-reduced-motion
8.2.2022
There is a code snippet that I see all the time when the media query prefers-reduced-motion is talked about. Here it is:
@media (prefers-reduced-motion: reduce) {
* {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms...
How to Cycle Through Classes on an HTML Element
26.1.2022
Say you have three HTML classes, and a DOM element should only have one of them at a time:
<div class="state-1"</div<div class="state-2"</div<div class="state-3"</div
Now your job is to rotate them. That is, cycle through classes …
How to Cycle Through Classes on...
Eye Droppin’
9.12.2021
Quick hits! There is a new web API called EyeDropper:
if ('EyeDropper' in window) {
const eyeDropper = new EyeDropper();
try {
// This has gotta be triggered by a user interaction,
// so consider this pseudo-code.
const result …
When is it “Right” to Reach for contain and will-change in CSS?
26.11.2021
I’ve got some blind spots in CSS-related performance things. One example is the will-change property. It’s a good name. You’re telling the browser some particular property (or the scroll-position or content) uh, will, change:
.el {
will-change: opacity;
…
The post When...
CSS “decorations”
22.11.2021
A reader wrote to me the other day asking about this bit of CSS they came across in Wikipedia’s Common.css:
.mw-collapsible-leftside-toggle .mw-collapsible-toggle {
/* @noflip */
float: left;
/* @noflip */
text-align: left;
}
What’s that @noflip business? That’s...