O'Reilly logo

Pragmatic Guide to Sass by Michael Lintorn Catlin, Hampton Catlin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

7Going Further with Advanced Scoping

In the last section, we introduced simple 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 we need to be more explicit. The last example we gave didn’t specify that the children were direct children. In standard CSS, we specify this directness as parent > child. If your CSS is rusty, that means finding a tag named <child> who’s exactly one level inside of a <parent> tag.

Using these kinds of CSS operators is as simple as you’d hope. Just start the child selector with the operator you want. So the child would be defined as > child inside of the parent definition.

Using nesting is a great way to organize ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required