• About Us
  • Privacy Policy
  • Disclaimer
  • Contact Us
AimactGrow
  • Home
  • Technology
  • AI
  • SEO
  • Coding
  • Gaming
  • Cybersecurity
  • Digital marketing
No Result
View All Result
  • Home
  • Technology
  • AI
  • SEO
  • Coding
  • Gaming
  • Cybersecurity
  • Digital marketing
No Result
View All Result
AimactGrow
No Result
View All Result

Resolved: CSS Class Prefix Selector

Admin by Admin
August 22, 2026
Home Coding
Share on FacebookShare on Twitter


Simply taking a look at what Bramus shared the opposite day:

/* Including a base class */
.btn {
  padding: 0.5rem 1rem;
  border-radius: 4px;
}

/* Itemizing the whole lot... yuck! */
.btn-primary,
.btn-secondary,
.btn-danger {
  padding: 0.5rem 1rem;
  border-radius: 4px;
}

/* Works, however performs badly */
[class^="btn-"],
[class*=" btn-"] {
  padding: 0.5rem 1rem;
}

/* Newly resolved class prefix selector */
.btn-* {
  padding: 0.5rem 1rem;
  border-radius: 4px;
}

First off, in case you don’t comply with Bramus, the place have you ever been?! Jokes apart, his job is to be first-in-line on new options like this — particularly because it pertains to Chrome — so it’s value preserving tabs on his RSS and/or social.

It’s not a brand new proposal. Lea posted it again in 2024 and has advocated for it the entire whereas. As Bramus mentions in his submit, what’s new is that the proposal was formally adopted and, as of three days in the past, it has been added to the Selectors Stage 5 spec draft. So, likelihood is that we’ll see it formally adopted sooner or later and applied someplace even sooner.

I actually just like the ergonomics of it. Current substring selectors — class^="prefix" and class=*" prefix" — are verbose and defintely much less readable than a easy .prefix-*.

And it’s not like [data-attribute] selectors that require not solely an additional step touching HTML however nonetheless added verbosity.

However one thing makes me wince on the thought. I can’t fairly put my finger on it. Maybe it’s redundancy as in, we are able to already do that with current selectors? Bramus cites efficiency points with current substring selectors as a main cause we’d like this. However Brian Kardell’s reply resonates with me:

Yeah, I assume if we have now a really particular case we are able to optimize it greater than a common one, however I am not seeing how it is a lot extra particular than the model above which nearly exists right now. Appears like if we may optimize this we may optimize that. I would be curious how it’s optimized.

— Brian Kardell (@bkardell.com) 2026-08-20T15:43:02.158Z

Then once more, I do like how we prolonged colour capabilities for brevity, like:

/* previous */
colour: rgba(10%, 20%, 20%, .25);

/* new */
colour: rgb(10, 20, 20 / .25);

And it’s backwards-compatible, so no actual hurt in case you proceed to make use of the “previous” method. It’s not like substring selectors don’t produce other use circumstances and develop into completely out of date. However possibly that’s it: this isn’t an “improve” of one thing we have already got, however a brand new factor that isn’t progressive enhancement out of the gate. We’d need to @help it till it turns into a Baseline characteristic:

@helps selector(.prefix-*) {
  /* ... */
}

…which can or will not be a protracted wait. However we don’t know. And if ergonomics are the promoting level, then we’re dropping that within the wait.

Also needs to be aware that the wildcard doesn’t match different circumstances or non-dashed circumstances:

/* Nope */
.prefix* {}
.prefix-*-suffix {}
.prefix_* {} /* the door is left open on this */

One other worthy be aware is that the spec presently implies (however doesn’t explicitly state) that this has the identical specificity as a category selector, (0,1,0). That’d make sense, as .prefix-* is absolutely no completely different than writing .prefix-variation.

That stated, I like the way it would possibly probably look in a nested syntax:

.prefix {
  /* This is able to work, proper? */
  &-* { /* ... */ }
}

…and Dave’s plea to help deciding on net elements:

Possibly I simply satisfied myself that I prefer it. Once more, I dunno. Simply take the added comfort and transfer on! Yada yada.


Direct Hyperlink →

Tags: classCSSPrefixResolvedSelector
Admin

Admin

Next Post
5 Should-Play New Steam Video games to Strive This Weekend

5 Should-Play New Steam Video games to Strive This Weekend

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recommended.

Tips on how to construct AI scaling legal guidelines for environment friendly LLM coaching and price range maximization | MIT Information

Tips on how to construct AI scaling legal guidelines for environment friendly LLM coaching and price range maximization | MIT Information

September 17, 2025
Finest Company Search engine optimisation Software program to Increase Web site Efficiency in 2025 — SitePoint

Finest Company Search engine optimisation Software program to Increase Web site Efficiency in 2025 — SitePoint

March 26, 2025

Trending.

HunyuanCustom Brings Single-Picture Video Deepfakes, With Audio and Lip Sync

HunyuanCustom Brings Single-Picture Video Deepfakes, With Audio and Lip Sync

May 8, 2025
AI & data-driven Starbucks – Deep Brew

AI & data-driven Starbucks – Deep Brew

May 18, 2026
A SQL MERGE assertion performs actions primarily based on a RIGHT JOIN

With jOOQ – Java, SQL and jOOQ.

May 25, 2025
A SQL MERGE assertion performs actions primarily based on a RIGHT JOIN

Use jOOQ’s code generator to simply go table-valued parameters

April 26, 2025
From Basement to Breakthroughs: Contained in the Studio Powering the Web’s Boldest Manufacturers

From Basement to Breakthroughs: Contained in the Studio Powering the Web’s Boldest Manufacturers

December 15, 2025

AimactGrow

Welcome to AimactGrow, your ultimate source for all things technology! Our mission is to provide insightful, up-to-date content on the latest advancements in technology, coding, gaming, digital marketing, SEO, cybersecurity, and artificial intelligence (AI).

Categories

  • AI
  • Coding
  • Cybersecurity
  • Digital marketing
  • Gaming
  • SEO
  • Technology

Recent News

From Experiment to Core Technique

From Experiment to Core Technique

November 20, 2026
Web Archive Staffers Are Unionizing

Web Archive Staffers Are Unionizing

November 20, 2026
  • About Us
  • Privacy Policy
  • Disclaimer
  • Contact Us

© 2025 https://blog.aimactgrow.com/ - All Rights Reserved

No Result
View All Result
  • Home
  • Technology
  • AI
  • SEO
  • Coding
  • Gaming
  • Cybersecurity
  • Digital marketing

© 2025 https://blog.aimactgrow.com/ - All Rights Reserved