mnot’s blog

Design depends largely on constraints.” — Charles Eames

Sunday, 30 May 2004

Ubiquitious Fragment Identifiers

Tim Bray is trying out “purple number signs” on his Web site to make fragment identifiers ubiquitous and easy to find.

This site has something along similar lines, through this CSS:

[id]:hover:after { 
  content: " #" attr(id) " "; 
  font-size: 50%;
  color: #ccc;
  text-decoration: none;
}

which means that everything with an id attribute gets its anchor advertised when you mouse over it; try the front page and the RSS tutorial for examples.

I prefer this to the “purple” approach, for two reasons. First, there’s less line noise when you’re browsing a page, while still making it easy to find anchors.

Second, and perhaps more importantly, I prefer to be a little more parsimonious with my anchors. Advertising them is a commitment on the part of the publisher to keep them meaningful and stable; in other words, to be cool URIs. While I have a reasonable hope of keeping heading-level anchors stable, I’m less confident that the meaning of every paragraph I write won’t change over time, sometimes very quickly.

In other words, anchors that aren’t linked to the semantics of a document can lead to brittleness and loss of utility, as discussed before. This isn’t to say that “purple”-style anchors are bad, but it does mean there should be a commitment to avoid changing the text in ways that invalidates them. It’s a pretty high bar for “living” documents, like Weblog entries.

At any rate, it’s great to see support for fragment identifiers getting more attention; I note that the new PDF media type registration documents a useful fragID syntax. Now if only Word did that…


Filed under: Web

2 Comments

Moose said:

This has been done in the past: http://www.markschenk.com/cssexp/index.html#id-tags

M.

Sunday, May 30 2004 at 10:55 PM +10:00

Ben Tremblay said:

Greets
FYI: the "PDF Media type" has moved; the whole site has been re-jigged:
ftp://ftp.rfc-editor.org/in-notes/rfc3778.txt

cheers

Thursday, October 12 2006 at 10:38 AM +10:00

Creative Commons