Intermediate CSS Workshop
Week 3 Review Questions
-
What is the "correct" (suggested) order for the four link-related pseudo-classes -
and why is that order suggested?
-
The order is linked, visited, hover, active . It is possible that two or
more of these "conditions" apply. For example, a user may have have the mouse poised over
a link which he or she has visited in the past – hence visited and hover would be
true. With specificity being the same, the style that gets applied is the last one listed in
the style. If hover for instance preceded linked and visited, one would never see the hover
effect because the hyperlink has either been visited or not (linked) and these coming later would
override hover.
- When working with images as links, how could you make the images look
and act like physical buttons - in their normal state and when hovered?
-
First of all there are two overall approaches to working with images and links
- Place the image tag within the anchor tag
- Use the image as the background-image within the anchor's style
To make the images seem button-like, first of all you can make images that are reminiscent
of buttons. Even if your image is not button like, you can change the hyperlink's display
property to block. You might give it a background-color, border, and so on. Then you can
use the dynamic pseudo-classes (e.g. hover) to change the image (if used as a background-image),
change the background color (especially if the image has some transparency), change the border,
etc.
- Write and show us a working demonstration of #2 (images that look and
act like buttons, especially when hovered) using CSS in an HTML (or XHTML) document.
-
Demo