Skip to Content
Pragmatic Guide to Sass 3
book

Pragmatic Guide to Sass 3

by Hampton Lintorn Catlin, Michael Lintorn Catlin
July 2016
Intermediate to advanced
130 pages
2h 11m
English
Pragmatic Bookshelf
Content preview from Pragmatic Guide to Sass 3
4Advanced Scoping

In Task 2, Scoping Selectors with Nesting, we introduced selector nesting. Just throw a selector inside a declaration block and BAM! It automatically scopes the style as being the child of the parent. However, sometimes you need to be more explicit. The last example didn’t specify that the children were direct children. In standard CSS, you can specify this directness as parent > child. If your CSS is rusty, that means finding a tag named <child>, which is exactly one level inside of a <parent> tag.

Using these kinds of CSS operators in Sass is as simple as you’d hope. As you can see in the example, a child selector can start with a > inside of the parent definition. Conversely, a parent can end with a >, affecting all

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Jump Start Sass

Jump Start Sass

Hugo Giraudel, Miriam Suzanne
What Employees Want Most in Uncertain Times

What Employees Want Most in Uncertain Times

Kristine W. Powers, Jessica B.B. Diaz
Mastering Sass

Mastering Sass

Luke Watts

Publisher Resources

ISBN: 9781680502060Errata Page