The fantastic thing about analysis is discovering your self on a very unrelated matter mere minutes from opening your browser. It occurred to me whereas writing an Almanac entry on @namespace
, an at-rule that we in all probability received’t ever use and is usually considered a legacy piece of CSS. Possibly that’s why there wasn’t a whole lot of data about it till I discovered a 2010s submit on @namespace
by Divya Manian. The submit was extremely enlightening, however that’s inappropriate; what’s necessary is that in Divya’s weblog, there have been arrows on the edges to learn the earlier and subsequent posts:

Don’t ask me why, however with out noticing, I by some means clicked the left arrow twice, which led me to a submit on “Notes from HTML5 Readiness Hacking.”

What’s HTML 5 Readiness?!
HTML 5 Readiness was a website created by Paul Irish and Divya Manian that confirmed the browser help for a number of internet options via the lens of a rainbow of colours. The options had been thought of (on the time) state-of-the-art or bleeding-edge stuff, equivalent to media queries, transitions, video and audio tags, and so on. As every browser supported a characteristic, a bit of the rainbow can be added.

I believe it labored from 2010 to 2013, though it confirmed browser help knowledge from 2008. I can’t describe how nostalgic it made me really feel; it jogged my memory of less complicated occasions when even SVGs weren’t absolutely supported. What nearly made me shed a tear was considering that, if this software was up to date immediately, the entire options can be coloured in a full rainbow.
A brand new internet readiness
It received me considering: there are such a lot of new options coming to CSS (many who haven’t shipped to any browser) that there might be a brand new HTML5 Readiness with all of them. That’s why I set myself to do precisely that final weekend, a Net Readiness 2025 that holds every of the options coming to HTML and CSS I’m most enthusiastic about.
You possibly can go to it at webreadiness.com!
Proper now, it seems kinda empty, however as time goes we’ll hopefully see how the rainbow grows:

Regardless that it was a weekend undertaking, I took the chance to dip my toes into a few issues I needed to be taught. Under are additionally some snippets I believe are value sharing.
The information is sourced from Baseline
My first thought was to mod the
internet part made by the Chrome staff as a result of I’ve been wanting to make use of it because it got here out. Briefly, it enables you to embed the help knowledge for an online characteristic straight into your weblog. Not way back, the truth is, Geoff added it as a WordPress block in CSS-Methods, which has been tremendous helpful whereas writing the Almanac:
Nevertheless, I instantly realized that utilizing the
can be needlessly laborious, so I as an alternative pulled the information from the Net Options API — https://api.webstatus.dev/v1/options/
— and displayed it myself. You will discover all of the out there options within the GitHub repo.
Every ray is an online part
One other characteristic I’ve been desirous to be taught extra about was Net Elements, and since Geoff just lately revealed his notes on Scott Jehl’s course Net Elements Demystified, I believed it was the right likelihood. On this case, every ray can be an online part with a easy reside cycle:
- Get instantiated.
- Learn the characteristic ID from a
data-feature
attribute. - Fetch its knowledge from the Net Options API.
- Show its help as an inventory.
Mentioned and performed! The simplified model of that code seems one thing like the next:
class BaselineRay extends HTMLElement {
constructor() {
tremendous();
}
static get observedAttributes() {
return ["data-feature"];
}
attributeChangedCallback(property, oldValue, newValue) {
if (oldValue !== newValue) {
this[property] = newValue;
}
}
async #fetchFeature(endpoint, featureID) {
// Fetch Function Operate
}
async connectedCallback() {
// Name fetchFeature and Output Checklist
}
}
customElements.outline("baseline-ray", BaselineRay);
Animations with the Net Animation API
I need to admit, I’m not too design-savvy (I hope it isn’t that apparent), so what I lacked in design, I made up with some animations. When the web page initially hundreds, a welcome animation is well achieved with a few timed keyframes. Nevertheless, the animation between the rainbow and record layouts is a bit more concerned because it is determined by the consumer’s enter, so now we have to set off them with JavaScript.
At first, I believed it will be simpler to do them with Identical-Doc View Transitions, however I discovered myself battling with the browser’s default transitions and the dearth of excellent documentation past Chrome’s posts. That’s why I made a decision on the Net Animation API, which helps you to set off transitions in a declarative method.
sibling-index()
and sibling-count()
Some time in the past, I wrote concerning the sibling-index()
and sibling-count()
features. As their names indicate, they return the present index of a component amongst its sibling, and the entire quantity of siblings, respectively. Whereas Chrome introduced its intent to ship each features, I do know it will likely be some time till they attain baseline help, however I nonetheless wanted them to rotate and transfer every ray.
In that very same submit, I talked about three choices to polyfill every perform. The primary two had been CSS-only, however this time I took the only JavaScript method which observes the variety of rays and provides customized properties with its index and whole rely. Certain, it’s a bit overkill because the quantity of rays doesn’t change, however fairly simple to implement:
const parts = doc.querySelector(".rays");
const updateCustomProperties = () => {
let index = 0;
for (let ingredient of parts.youngsters) {
ingredient.fashion.setProperty("--sibling-index", index);
index++;
}
parts.fashion.setProperty("--sibling-count", parts.youngsters.size - 1);
};
updateCustomProperties();
const observer = new MutationObserver(updateCustomProperties);
const config = {attributes: false, childList: true, subtree: false};
observer.observe(parts, config);
With this, I might place every ray in a 180-degree vary:
baseline-ray ul{
--position: calc(180 / var(--sibling-count) * var(--sibling-index) - 90);
--rotation: calc(var(--position) * 1deg);
rework: translateX(-50%) rotate(var(--rotation)) translateY(var(--ray-separation));
transform-origin: backside middle;
}
The choice is JavaScript-less
Within the browser captions, in the event you hover over a selected browser, that browser’s colour will come out extra within the rainbow whereas the remainder turns into somewhat clear. Since in my HTML, the caption ingredient isn’t anyway close to the rainbow (as a father or mother or a sibling), I believed I would want JavaScript for the duty, however then I remembered I might merely use the :has()
selector.
It really works by detecting at any time when the closest father or mother of each parts (it might be
, or the entire
) has a .caption
merchandise with a :hover
pseudo-class. As soon as detected, we enhance the dimensions of every ray part of the identical browser, whereas reducing the opacity of the remainder of the ray sections.
What’s subsequent?!
What’s left now could be to attend! I hope folks can go to the web page now and again and see how the rainbow grows. Like the unique HTML 5 Readiness web page, I additionally need to take a snapshot on the finish of the yr to see the way it seems till every characteristic is absolutely supported. Hopefully, it received’t take lengthy, particularly seeing the browser’s effort to ship issues quicker and enhance interoperability.
Additionally, let me know in the event you assume a characteristic is lacking! I attempted my greatest to choose thrilling options with out baseline help.