Home / CSE / CSS - CS :: Discussion

Discussion :: CSS - CS

  1. Which of the following selector is used to selects the element that is the nth child of its parent?

  2. A.

     :nth-child(n)

    B.

     ::first-line

    C.

     :last-of-type

    D.

     :first-of-type

    View Answer

    Workspace

    Answer : Option A

    Explanation :

    div:nth-child(2) {background-color: red;}
    /* sets the background color to red if the div is its parent’s second child */


Be The First To Comment