HTML5 and CSS 3 – Illustrated 2nd Ed. Instructor’s Manual: Unit F Page 8 of 15
• Point out the display type for an a element must be either inline-block or block if students want to
change the margins, padding, or borders of the a element, as well as other box-model properties
such as background color.
• Remind students that they must take care not to change elements of an a element that will affect
the page layout when implemented, such as changing the line height of an a element when the
element is hovered over.
FIGURES: F-11, F–12
BOXES
1. Quick Tip: The a:hover pseudo-class is usually not applied when interacting with the
touchscreen or on a device such as a smartphone or tablet.
2. Clues to Use: Styling the :hover pseudo-class
3. You can style the :hover pseudo-class using any property that is valid for an a element.
However, it’s best to avoid changing the values of properties for the :hover pseudo-class that
affect the line height of text, such as line-height, font-size, or font-weight. Changing any of
these properties can affect the page layout—for instance, it can cause the elements below a nav
bar to move down temporarily because the height of the nav bar increases to accommodate the
new value while the mouse pointer is over a link. Instead, properties such as color, background–
color, and text-shadow are commonly used to affect the appearance of links while the mouse
pointer is over them but without affecting the overall layout.
4. Clues to Use: Understanding the difference between pseudo-elements and pseudo-classes
Both pseudo-elements and pseudo-classes are CSS selectors that you specify with a colon
preceding them. However, there are a number of differences between these two features. You
use a pseudo-element to work with part of an element, such as the first letter. As long as the
base element exists in your HTML code, a style rule that uses a pseudo-element selector is
always applied to the page. By contrast, you use a pseudo-class to style an element based on the
status of user interaction with it. This means that styling for a pseudo-class can be applied to a
web page at certain times and not at others—for example, only when the mouse pointer or