Graphics Programs Reference
In-Depth Information
Figure 2-10: Selecting links with an attribute selector.
Note that it doesn't matter in the slightest what value the
href
attribute holds. In fact, it
doesn't even matter if the value is a valid URI or other resource. You'll select
<a href="#">
just the same as
<a href="http://w3.org/">
.
Now, what if you wanted to, say, select all of the hyperlinks that point to a specii c address?
If you have an exact URI you want to pick out, then you could do it just like this (see Figure
2-11):
a[href="http:
//
w3.org
/"] {
font-style
:
italic
;}
55
Figure 2-11: Selecting links with a specifi c URL with an attribute selector.
h at will select only
a
elements whose
href
attributes have the value
http://w3.org/
.
Notice how I phrased that? I didn't say “hyperlinks that point to the W3C site,” because that's
not the deal. h e deal is that you must have an exact match, character for character. If you
have
<a href="http://www.w3.org/">
, the selector shown just now will not select
that link. h e match must be exact.
h is might not be so useful with hyperlinks, but it could help you with picking specii c images
to be styled—say, your company logo. If your CMS always spits out this for your top-of-page
logo:
<
img
src
="/img/2010/mainlogo.png"
alt
="ConHugeCo Inc."
/>


























Search WWH ::

Custom Search