[thelist] A:Active Working Example?

MaKo shark at mako4css.com
Mon Feb 24 14:09:01 CST 2003


Rob,

> There was a topic a few days ago about highlighting the active or
currently
> link you're on, but it really wasn't answered to my satisfaction. After

What you could do is declare a custom class for the anchor of the page
that you are on, like:

a.nowon:link {
    color: #FF00FF;
    background: #CDCDCD;
    font-size: 1.5em;
    }

and then, in the document, exchange the usual class (let's say
a.navi:link) with this class:

<a class="navi" href="whatever.htm">Normal Anchor</a>
<a class="nowon">Here I am!</a>
etc.

> researching the a:active css property, I realized that this is what
happens
> on the press state of the mouse click.

Yup. a:active describes the moment the anchor is 'activated' by the user,
see:
http://www.w3.org/TR/REC-CSS2/selector.html#dynamic-pseudo-classes

> Rudy's example of the various css styles looked promising but I wasn't
> convinced that would work as it didn't reset visited links.
>

I don't have this example, but it should - if the sequence was correct.
See http://www.mako4css.com/BasLink.htm - the sequence of the pseudo
classes is important.

> I tried but failed to implement a class definition solution. Here's my
css:
>
> A.selected {
> color: #911100;

Have you also declared the :link, :visited, :hover classes? If yes, and it
still didn't work, then there is something else out of whack - an URL
would be helpful...

> BTW, is css case sensitive? a.something vs. A.something? I would really
like
> to see a working example. Thanks efolk.
>

Perhaps :)

I quote from the W3C:
------------------------
The case-sensitivity of document language element names in selectors
depends on the document language. For example, in HTML, element names are
case-insensitive, but in XML they are case-sensitive.
-------------------------

Meaning, in HTML a.something is the same as A.something.

BUT:

http://www.w3.org/TR/REC-CSS2/syndata.html#q4 clearly states that

"All CSS style sheets are case-insensitive, except for parts that are not
under the control of CSS."

Meaning, that if you declare a class like:

.Warning
one browser will accept <div class="warning"> , but another will not. (IE
and Moz come to mind).

Therefore: keep it consistent. I am gradually re-training myself to write
in lowercase, selectors as well as class names, simply to be on the safe
side.

--HTH

MaKo
~~just when you thought it was safe to go back into the water~~
http://www.mako4css.com/





More information about the thelist mailing list