Advertise with us

Direct child selectors in css

Hi Expert,

what is direct child selectors in css and how to use this? Please guide me.

Thanks in advance.
Last updated:6/17/2013 4:19:12 AM

1 Answers

Dev Patel
Dev Patel

Hi,


Direct child selectors operate much like descendant selectors in that they also rely on an ancestral relationship to decide where to apply style. Descendant selectors, however, are more ambiguous because they apply to any descendant of an element; the descendant cab be a grandchild or a great-grandchild, or a great-great-grandchild, and so on. Direct child selectors apply only to immediate children of the element. 

e.g. 

p > span.inline-code {
font-family: monospace;
}

Last updated:6/17/2013 4:19:12 AM

Answer