- From: Matthew Raymond <mattraymond@earthlink.net>
- Date: Wed, 11 Oct 2006 22:05:08 -0400
- To: W3C CSS <www-style@w3.org>
If you have a list of hyperlinks you're using for navigating a website, and this list is identical for all pages, you'll want to indicate which link points to the current page. One way to do this is to put a |class| attribute on the element for the hyperlink that links to the current page: | <ul> | <li> | <a class="currentpage" href="home.html">Home</a> | </li> | <li> | <a href="products.html">Products</a> | </li> | <li> | <a href="services.html">Services</a> | </li> | <li> | <a href="contacts.html">Contacts</a> | </li> | <ul> Such markup would require you to edit all pages in the list of hyperlinks. Alternatively, you could use Javascript to add the |class| attribute, but that requires additional programming skill that not everyone is capable of. It would be far simpler to have a pseudo-class that could select the <a> element that links to the current page: | a:current { background-color: white; } | a:current:hover { text-decoration: none; } A pseudo-class like this should be no harder to implement or more expensive than :target. Any thoughts on this?
Received on Thursday, 12 October 2006 02:05:26 UTC