Test Series - css

Test Number 25/59

Q: What type of selector is used in this case?

p {line-height: 150%;}
A. class Selectors
B. element Selectors
C. id Selectors
D. None of the mentioned
Solution: These selectors are called element selectors and are simply used
as follows:
element-name { /* properties */ }
Q: By applying an ___________ a style can be applied to just a single tag.
A. class rule
B. element rule
C. id rule
D. None of the mentioned
Solution: By applying an id rule, a style can be applied to just a single tag. For example, if we name a tag with a unique id attribute as follows
Affected Text
Q: The _____________ attribute is used to define the name(s) of the class(es) to which a particular tag belongs.
A. class
B. element
C. id
D. None of the mentioned
Solution: Self-explainatory.
Q: What will be the output of below mentioned code snippet?

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
Solution: All occurrences of the strong element within a p element have a yellow background.
Q: 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. 
Solution: Self-explainatory.
Q: Which of the following selectors selects any tag with an id attribute set?
A. E#id
B. .class
C. #id
D. *
Solution: Explanation: Example:#test {color: green;}
/* makes a tag with id=’test’ green */
Q: Which of the following selectors selects direct descendents?
A. E > F
B. E F
C. E + F
D. E ~ F
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 */
Q: Which of the following selectors selects siblings?
A. E.class
B. E ~ F
C. *
D. E, F, G
Solution: p ~ strong {font-style: italic;}
/* sets the font style to italic on
all strong tags that have a p tag
as a preceding sibling */
Q: Which of the following selectors selects adjacent siblings?
A. E > F
B. E F
C. E + F
D. E ~ F
Solution: h1 + p {color: red;}
/* makes all p tags that are
immediately preceded by an h1 tag
red */

You Have Score    /9