Qualsiasi vecchio collegamento di ancoraggio può essere un collegamento a un documento PDF, ma fare clic su un collegamento del genere pensando diversamente può essere sorprendente e scomodo per un utente. Questo CSS può indicare visivamente quei collegamenti.
/* Add " (PDF)" text after links that go to PDFs */ a(href$=".pdf"):after ( content: " (PDF)"; ) /* If file size specified as data attribute, use that too */ a(href$=".pdf")(data-size):after ( content: " (PDF, " attr(data-size) ")"; )
Così…
Watch out for the PDF bomb here!
Visivamente diventa:
Watch out for the PDF bomb (PDF) here!
O…
Watch out for the PDF bomb here!
Diventa:
Watch out for the PDF bomb (PDF, 2 MB) here!
Guarda Pen Identify PDF Bombs di Chris Coyier (@chriscoyier) su CodePen.