Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS

Ektoras Drandakis
Ektoras Drandakis
29,580 Points

Check parent tag using Sass

Is it possible to check what is the parent tag of an element with Sass? For example i'd like to check if a paragraph is inside a footer before applying styling.

1 Answer

Emily Easton
Emily Easton
13,575 Points

I don't know if you can so I'm not here to answer your question - but other ways of doing this could be just simply looking in the code you've written (which isn't ideal).

Or by using dev tools to inspect the element and then look at what the parent is. You can click on the top left button in the dev window (in chrome - I don't know about any others but I'm sure you'd be able to find out on google) and you can just hover over the element and it will highlight what you are hovering over and it will say what it is eg a <p> then from this move up and up until you discover the parent element. If you click on it then it will give you more detail about it etc.

I'm more than likely telling you something that you know but this is what I would do n I hope this helps until you get a proper answer!