In: Computer Science
Related to HTML/CSS. Please choose correct answer.
Descendent selectors can be used to select....
a. only nested element
b. only parent/child element
c. only nested type selector
d. any element state
Answer = (b) only parent/child element
Rather I would say its more appropriate answer would be to select parent/descendent element because if we look at the example of a Descendent selectors,
let's say
SYNTAX OF Descendent selectors :
selector1"space"selector 2
{
function list;
}
the above function will select any html element targated by selector 2, which is a Descendent of element targated by selector1.
NOTE: "space" is just to let you know that there is a space between selectror1 and selector2.
This is the Example of Descendent selectors =
div p
{
border:5px solid green;
}
It select only those p elements which are the Descendent of any div element and then make a border of solid green colour of width 5 px around them.
In the Above example it targets elements p (which is written after the space) , which are Descendent of selector "div" (which is written before space).
If you have any doubts,just let me know!!!