I recently read the book “CSS Mastery: Advanced Web Standards Solutions” which I highly reccommend to anyone who uses CSS extensively. In the book it lists not just what you can do, but how to do it right. One selector that I read about in the book and implemented last week was the [att$=val] attribute selector.
This selector is super easy to use and looks like this:
a[href$=".pdf"] {
padding:7px 0 4px 31px;
background: url(images/pdfsmall.jpg) no-repeat left top;
display: block;
}
This way any time someone links a .pdf document, a “Acrobat Reader” icon will show up to the left of the link, this way the visitor knows what he’s getting into when he clicks it.
Now the link looks like this:
This works just as well with any other attribute. Just swap out the .pdf and image name and there it is.
Tim Grahl
Author
Tim Grahl is the author of Your First 1000 Copies and the founder of BookLaunch.com. He has worked with authors for a decade to help them build their platform, connect with readers, and sell more books. He has worked 1-on-1 with over a hundred authors including Daniel Pink, Hugh Howey, Barbara Corcoran, Chip and Dan Heath, Sally Hogshead and many others. He has also launched dozens of New York Times, Wall Street Journal, and Washington Post bestsellers.
Comments
Launch Your Book to Bestseller Status.
Unlock Tim’s Book Marketing Plan: The Definitive Checklist – your ultimate guide to launching a bestselling book. Tim has helped hundreds of authors succeed, and these proven strategies will help you achieve your book launch goals too.
Fill out the form below to get his checklist delivered straight to your inbox.
Leave a Reply