Ability to prepend class to the selector
See original GitHub issueIn many cases it makes sense to have elements styled based on context.
For example:
We have standard HTML widget <article class="featured">…</article> used in both home page and featured posts pages. Yet home page has <body class="home-page">, featured <body class="featured-page"> (technique commonly used in WordPress and similar CMS’es)
All else being equal, we want our article in featured posts page to have bigger H1 text.
At the moment we would have to put custom new css rule away from the main H1 definition like
.featured{
.heading {
h1{
color: nice;
font-size: normal
}
}
.. lots of other css'es
}
.home .featured .heading h1 { font-size: bigger}
This makes our code nightmare to manage, as totaly related rules are separated 😕
However, if we just could have modifier to prepend css selectors to the stack like
.featured{
.heading {
h1{
color: nice;
font-size: normal;
< .home {
font-size: bigger;
}
}
}
.. lots of other css'es
}
to compile to
.featured . heading h1 { color:nice; font-size: normal;}
.home .featured . heading h1 { font-size: bigger;}
This would be awesome 😃
Issue Analytics
- State:
- Created 11 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Prepend all CSS selectors - Stack Overflow
All I want, is to be able to prepend an ID "#content" to every selector in a css file. javascript · jquery ·...
Read more >Selectors - W3C
A simple selector is either a type selector or universal selector followed immediately by zero or more attribute selectors, ID selectors, or pseudo-classes,...
Read more >Do we not have the ability to add class and id selectors to ...
I have been able to select the links using querySelectorAll but it wont let me add a class to the elements. The console...
Read more >Specificity - CSS: Cascading Style Sheets - MDN Web Docs
Specificity is the algorithm used by browsers to determine the CSS declaration that is the most relevant to an element, which in turn, ......
Read more >CSS Selectors
So far, we have only been able to select every instance of a particular tag in ... In a case like that, you...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
use
to prepend.
It works but doesn’t group. There is a feature request to group…