Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SASS: Direct Descendent rule?

Tags:

css

sass

How do I represent a direct descendent CSS rule in SASS?

Ex.

body > div { ... } 

Couldn't seem to find it in the docs: http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html

like image 287
neezer Avatar asked Jan 15 '10 22:01

neezer


People also ask

How do I target a direct child in SCSS?

In the HTML file in your content make sure that you are placing child tags or having child tags inside a parent tag. Once you are done with the HTML tag then use ” & ” and ” > ” in the SCSS file to style the direct children.

How do you use Combinators in SCSS?

Selector Combinators permalinkSelector Combinators You can nest selectors that use combinators as well. You can put the combinator at the end of the outer selector, at the beginning of the inner selector, or even all on its own in between the two.

What is &__ in SCSS?

The & is a special selector invented by SCSS which is used in nested selectors to refer to the outer selector . It simply means that it will be replaced with the outer selector when compiling to CSS.


1 Answers

You should just be able to

body   >div     property:value 

You may have to escape the > with a backslash \.

like image 55
Ryan Joy Avatar answered Sep 29 '22 01:09

Ryan Joy