HTML and CSS Reference
Combining pseudo-element selectors
In this thought experiment, apply what you've learned about this objective. You can
find an answer to this question in the “Answers” section at the end of this chapter.
Consider how you can get very specific styles applied to your HTML elements
through the combination of pseudo-classes and pseudo-elements. For example,
how would you change the appearance of the first letter of the first paragraph of
each group of paragraphs on the page but only when the user hovers over it? Ex-
periment with other combinations of selectors to achieve specific effects.
■ Referencing elements correctly takes careful consideration of how you will structure
your CSS and your HTML elements.
■ Selectors can be nested and joined together to get more specific.
■ HTML elements inherit styles automatically from their parent elements.
■ CSS is processed from the top down, so that last style processed wins if it conflicts with
other style declarations.
■ !important can be used to ensure that the desired style is rendered when there is a
competing CSS declaration.
Answer the following questions to test your knowledge of the information in this objective.
You can find the answers to these questions and explanations of why each answer choice is
correct or incorrect in the “Answers” section at the end of this chapter.
The review questions use the following HTML listing (line numbers are for reference only):