Using CSS to display accesskeys

Reading Going to Print by Eric Meyer I discovered the CSS attr function. Eric used it to show the href attribute for anchors in the print style sheet. You can also use this function to show accesskeys in the screen style sheet:

a[accesskey]:after {
  text-transform: uppercase;
  content: ": " attr(accesskey);

1 comment:

Johan Sundström said...

Nifty; thanks for passing on the tip; I didn't know about attr(), either.