On Fri, Mar 4, 2011 at 23:58, Peter Desjardins
<
peter.desjardins.us@gmail.com> wrote:
> On Fri, Mar 4, 2011 at 11:37 AM, David Cramer <
david@thingbag.net> wrote:
> I just got another trick from someone who works with CSS fairly
> regularly. He suggested this:
>
> a[href] {
> color: purple;
> }
>
> I didn't realize that CSS can select by attribute using square bracket
> syntax. I had tried the pseudoclass technique earlier and found that
> using a:hover and a:active would style the non-link content also.
> a[href]:hover and a[href]:active seem to style only the actual links
> now.
FYI, when using pseudo classes, you need to specify that you want to
style links, not just any element that’s active or focused:
,----
| :link { color: blue; }
|
| :visited { color: purple; }
|
| :link:active, :visited:active { color: red; }
|
| :link:hover, :visited:hover, :link:focus, :visited:focus {
font-weight: bold; }
`----
This also has the dubious advantage of working with links created
using other elements, wherever they may be. :-)
Aankhen