Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8856111
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:17:10+00:00 2026-06-14T14:17:10+00:00

Say I have a placeholder selector in Sass. Within that selector I write some

  • 0

Say I have a placeholder selector in Sass. Within that selector I write some styles where it becomes apparent that I need to check for the feature using Modernizr.

The problem appears that you go to use the .no-generatedcontent or .generatedcontent classes provided by modernizr but they can’t be used as they will be in the wrong hierarchical location once the placeholder selector has done it’s work.

The only way I can see of solving this is to put them outside the placeholder selector, but this messes up my styles where Sass is meant to help keep my styles more organised.

Any ideas on how this can be work-around?

Here’s an example of what I mean:

The <html> tag at the top of my page once modernizr has completed it’s work:

<html class="js flexbox flexboxlegacy canvas canvastext webgl touch geolocation postmessage websqldatabase indexeddb hashchange history draganddrop websockets rgba hsla multiplebgs backgroundsize borderimage borderradius boxshadow textshadow opacity cssanimations csscolumns cssgradients cssreflections csstransforms csstransforms3d csstransitions fontface generatedcontent video audio localstorage sessionstorage webworkers applicationcache svg inlinesvg smil svgclippaths wf-allumistd-n1-active wf-freightsanspro-n3-active wf-automate-n4-active wf-automate-n7-active wf-active">

Now, Say I have a placeholder selector called %styles

%styles {
li {
this: this;
}
.no-generatedcontent li {
this: that;
}
}

Now, I go and use this placeholder somewhere in my code as below:

.main {
section {
.box-area {
color: red;
@extend %styles;
}
}
}

It seems apparent to me that the modernizr class is in the wrong location for it to have any effect. It’s a sort of hierarchy problem. I could solve it by putting it outside the placeholder but then I have to @extend it separately and my sass code gets in a mess which is the primary reason I started using sass to keep my styles tidier.

Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T14:17:12+00:00Added an answer on June 14, 2026 at 2:17 pm

    The Sass:

    %styles {
        li {
            border: 1px solid red;
    
            .no-generatedcontent & { // note the location of the & here
                border: 1px solid red;
            }
        }
    }
    
    .main {
        section {
            .box-area {
                color: red;
                @extend %styles;
            }
        }
    }
    

    The CSS:

    .main section .box-area li {
      border: 1px solid red; }
    
    .no-generatedcontent .main section .box-area li, .main section .no-generatedcontent .box-area li {
      border: 1px solid red;
      background: #CCC; }
    
    .main section .box-area {
      color: red; }
    

    There seems to be a bug when using @extend (see how it’s generating 2 selectors on the .no-generatedcontent line? Sass 3.2.3). This doesn’t happen if I use a mixin instead:

    .main section .box-area {
      color: red; }
    
      .main section .box-area li {
        border: 1px solid red; }
    
      .no-generatedcontent .main section .box-area li {
        border: 1px solid red;
        background: #CCC; }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say I have a SSI script that uses exec, or a PHP script that
Let's say we have a class that looks like this: class A { public:
I have a Masterpage that has Treeview. You can select some nodes there. Based
I have a record in a table that serves as a placeholder of sorts,
I would like some help with a OOD query. Say I have the following
I have a large group of text box's that need to be validated..used the
Lets say have this immutable record type: public class Record { public Record(int x,
Say I have a select box eg <div data-bind='visible: someProp'> <select class=selectSubWidgets data-bind='options: subWidgets,optionsText:
Say I have a Telerik MVC Grid, AJAX bound and I want to put
Say we have deep hashes like: b = {1 => {2 => {} },

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.