Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parent selector not working #211

Open
RedHatter opened this issue Jun 28, 2016 · 3 comments
Open

Parent selector not working #211

RedHatter opened this issue Jun 28, 2016 · 3 comments

Comments

@RedHatter
Copy link

RedHatter commented Jun 28, 2016

When I use the code below #thing get a width of 0.

#content {
  width: == 800;
  #thing {
    width: == ^[width];
  }
}

But when I reference #content directly #thing gets a width of 800 as expected.

#content {
  width: == 800;
  #thing {
    width: == ($ #content)[width];
  }
}

What am I missing? Why doesn't the first code work?

@RedHatter RedHatter changed the title Constraint works as standalone but not in ruleset, Parent selector not working Jun 28, 2016
@gabeblackbeard
Copy link

gabeblackbeard commented Jul 28, 2016

Hey there. I figure you probably found a way around this issue by now, but I'll leave here the solution I've found nonetheless, as maybe it will help others.

For some reason, if you are writing your code inside a separate file that is linked by the html page, your whole nesting must be done inside a "body" selector. Like this:

body {
    #parent-div {
        width: == 800;
        #child-div{
           width: == ^width;
        }
    }
}

If you do it like that, child-div's width will successfully refer to parent-div's width. Otherwise it seems it will refer to (I believe) the document's width.

If your code is in a style tag in the head of the html page, however, no "body" selector is necessary; your code would have worked as is.

I have no idea what causes this behavior, but there it is. Maybe someone will shed a better light on why it works like that.

@Inviz
Copy link
Contributor

Inviz commented Jul 30, 2016

Try more up to date version from master.

@H-s-O
Copy link

H-s-O commented Nov 11, 2016

Thanks @gabeblackbeard for the body selector tip !

If anyone of the GSS team is listening, this needs to be adressed in the documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants