• 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.

Experiment with Gemini 2.0 Flash native picture technology

Experiment with Gemini 2.0 Flash native picture technology

April 24, 2026
Tesla board chair calls debate over Elon Musk’s $1T pay bundle ‘just a little bit bizarre’

Tesla board chair calls debate over Elon Musk’s $1T pay bundle ‘just a little bit bizarre’

September 14, 2025

Trending.

AI & data-driven Starbucks – Deep Brew

AI & data-driven Starbucks – Deep Brew

May 18, 2026
7 Greatest Digital Desktop Infrastructure (VDI) Software program (2026): My Picks

7 Greatest Digital Desktop Infrastructure (VDI) Software program (2026): My Picks

September 9, 2026
High LLM Observability and Analysis Platforms in 2026: Langfuse, LangSmith, Braintrust, Arize, and Extra In contrast

High LLM Observability and Analysis Platforms in 2026: Langfuse, LangSmith, Braintrust, Arize, and Extra In contrast

August 9, 2026
The ten Finest Films That Get Synthetic Intelligence Proper

The ten Finest Films That Get Synthetic Intelligence Proper

May 27, 2026
The Full Information to EcoGPT

The Full Information to EcoGPT

June 6, 2026

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

A profile of OpenAI CFO Sarah Friar, who sources say helped preserve OpenAI’s Microsoft deal on monitor and has privately steered ready till 2027 for an IPO (Wall Road Journal)

DeepSeek is near elevating $12B+ in a spherical that would attain ~$14.9B, with Tencent and CATL as the most important contributors, forward of an early-2027 IPO (Bloomberg)

October 6, 2026
Belief, Management and ROI: AI’s Subsequent Chapter

Belief, Management and ROI: AI’s Subsequent Chapter

October 6, 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