DIRECT CHILD SELECTORS IN CSS

E E Cummings

Total Post:26

Points:182
Posted by  E E Cummings
 1262  View(s)
Ratings:
Rate this:
Hi Expert,

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

Thanks in advance.
  1. Dev Patel

    Post:26

    Points:182
    Re: Direct child selectors in css

    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;
    }

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!