Archive for July 30, 2007

Suggestion for new link pseudo-class, “:current”

[ music | 12 – Duran Duran – To Whom It May Concern ]

Today I sent out an email to the WWW-Style Mailing List. I’m sure most Mozillians don’t read it, however, so I’m reposting it here for comments, opinions, etc. Please leave your thoughts in the comments as I’m interested in everyone’s opinion on this.

It's entirely possible I'm an idiot, however, I think I see an opportunity for a useful addition to the link pseudo-classes. The link pseudo-classes states:

"The :link pseudo-class applies for links that have not yet been visited."

"The :visited pseudo-class applies once the link has been visited by the user."

Recently I've been building a site, and using a new idea on a navigation menu. Once you get beyond a few pages, it's tedious to manage a code block between pages, so one resorts to server side scripting to manage it. In this case, the current page's entry in the menu is styled differently than the rest to indicate the user's current location in the site.

However, I realized that maybe rather than changing the menu HTML server side, I could just use a pseudo-class and style it differently, as one can have unvisited and visited links styled differently automatically by the browser. To my dismay, I discovered there is currently no method to do this.

My idea, which I'm certain has been bandied about a dozen times before, is to add a :current (or some other name) pseudo-class that refers only to URLs that match the currently loaded page, and can be styled differently like :visited and :link. Already browsers have to determine if an URL is unvisited or not, so I don't really see that this additional check would be a greater onus than what they already do, and it could make life a little easier on developers, less server side scripting.

Comments? I'd love to hear support, but also I'd like to hear why this would be a bad idea.


Comments (10)