HomeThe Classics

A Couple Tips For Using Text Fragments

Published:

I had to reference something and I was about to quote a passage but I realized I can link to a text fragment (which end like #:~:text=...) instead. Took some time to figure out and in doing so I have 2 tips.

  1. Quote as little as necessary.
  2. Take advantage of progressive enhancement and include a regular fragment to navigate to in case text fragments are unsupported..
  3. Understand that you can specify non-matching prefixes and suffixes as well as multiple fragments to highlight. Just read the MDN article I linked.