HTML and CSS Reference
In-Depth Information
Thought experiment
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.
Objective summary
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.
Objective review
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):
1. <html>
2. <body>
3. <div>
4. <hgroup>
5. <h1></h1>
6. <h2></h2>
7. </hgroup>
8. </div>
9. <div>
10. <section>
11. <article>
12. <h1></h1>
13. <p></p>
14. <p></p>
15. </article>
 
 
Search WWH ::




Custom Search