Graphics Programs Reference
In-Depth Information
Figure 2-15: PDF icons for links to PDF documents.
Pretty awesome! Here are some other ideas for using attribute selectors to style types of links.
Secure-server links
E-mail contact links
AOL Instant Messenger service links
Microsoft Word documents
Microsoft Excel documents
Zip archives
As always, remember that you aren't restricted to hyperlinks here. If you recall the “Figure”
examples from the preceding section, you will quickly realize that a lot of the problems that
came up can be solved with a simple caret:
img[alt^="Figure"] { border : 1px solid gray ;}
h ere: Now we're selecting based on an image's alt text beginning with that exact string, and
don't have to worry about cases where it shows up later in the text. h ey'll be skipped.
One of the things we do most ot en with CSS is select elements based on their place in the
document's hierarchy. h is is most ot en done with a descendant selector, like this:
div#header a { color : #DEFACE ;}
h at selects a elements that descend from (are contained within) any div with an id of
header .
In most cases, this is exactly what we want: to select the links within the header, no matter where
inside the header they may be, and no matter what elements might be “between” the two.
Sometimes, though, you want to select elements that are direct children of another element,
not an arbitrary descendant. Imagine that you only want to select list items that are the
children (not descendants) of an ol element (see Figure 2-16). h at way, if there are any
unordered lists within the ordered list, their list items won't be selected. All we need is a child
Search WWH ::

Custom Search