21. What will happen in this case? p strong {background-color: yellow;} A. Strong have yellow background B. Strong element within a p element have a yellow background C. Both p and strong have yellow background D. None of the mentioned Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option B Solution: All occurrences of the strong element within a p element have a yellow background.
22. A similar rule called the ____________ is specified using the plus sign (+) and is used to select elements that would be siblings of each other. A. class selectors B. attribute selectors C. adjacent-sibling selector D. none of the mentioned Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option C No explanation is given for this question Let's Discuss on Board
23. Which of the following selectors selects any tag with an id attribute set? A. E#id B. .class C. #id D. * Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option C Solution: Example:#test {color: green;} /* makes a tag with id=’test’ green */
24. Which of the following selectors selects direct descendents? A. E > F B. E F C. E + F D. E ~ F Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option A Solution: Example: body > p {background-color: yellow;} /* makes all p tags that have the body tag as their immediate parent have the background color yellow */
25. Which of the following selectors selects siblings? A. E.class B. E ~ F C. * D. E, F, G Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option B Solution: Example: p ~ strong {font-style: italic;} /* sets the font style to italic on all strong tags that have a p tag as a preceding sibling */
26. Which of the following selectors selects the specified elements of type E with a particular class value? A. E.class B. E ~ F C. * D. E, F, G Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option A Solution: Example: h1.note {text-decoration: underline;} /* underlines all h1 tags with class='note' */
27. Which of the following selectors selects adjacent siblings? A. E > F B. E F C. E + F D. E ~ F Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option C Solution: Example: h1 + p {color: red;} /* makes all p tags that are immediately preceded by an h1 tag red */