{"id":6,"date":"2005-04-26T21:25:21","date_gmt":"2005-04-27T03:25:21","guid":{"rendered":"http:\/\/markup.thekraemers.com\/?p=4"},"modified":"2005-04-26T21:25:21","modified_gmt":"2005-04-27T03:25:21","slug":"anchors-and-images-titles-and-alts","status":"publish","type":"post","link":"http:\/\/markup.thekraemers.com\/?p=6","title":{"rendered":"Anchors and Images, titles and alts"},"content":{"rendered":"<p>The question arose at the office last week, \u00e2\u0080\u009cis there a best practice on using the title attribute on the &#60;a&#62; vs. &#60;img&#62; tags when the link wraps the image?\u00e2\u0080? With so many attributes available it can be confusing to know which ones to use when.<\/p>\n<p>The <code>title<\/code> attribute tells you where a link is going. They will appear as a tool-tip when moused over (in modern browsers) and they can be read aloud by screen readers. They aid the user in letting them know where a link will take them. Anchors (<code>a<\/code>) should have <code>title<\/code> attributes as a matter of manners. As an example:<\/p>\n<p><samp><br \/>\nI just read &#60;a href=&#8221;http:\/\/www.downwithwallpaper.com\/tips.html&#8221; title=&#8221;DownWithWallpaper.com | How to take down wallpaper&#8221; \/&#62;a great article&#60;\/a&#62; that gave me some home improvement tips.<\/samp><\/p>\n<p>The <code>alt<\/code> attribute tells you what you&#8217;re looking at. Screen readers use this as the verbal description for the image.<\/p>\n<p>So, the best practice for links around images would be:<\/p>\n<p><samp><br \/>\n&#60;a href=&#8221;http:\/\/navigatorsystems.com&#8221; title=&#8221;NavigatorSystems.com | Home&#8221; &#62;&#60;img src=&#8221;logo.gif&#8221; alt=&#8221;Navigator Systems logo&#8221; \/&#62;&#60;\/a&#62;<br \/>\n<\/samp><\/p>\n<p>Make sense? Now I have to go clean up all my code to make sure I am using them correctly.<\/p>\n<p>The first code example here was stolen from <a href=\"http:\/\/www.simplebits.com\/\" title=\"Dan Cederholm's SimpleBits.com\">Dan Cederholm\u00e2\u0080\u0099s<\/a> <a href=\"http:\/\/www.amazon.com\/exec\/obidos\/ASIN\/1590593812\/ref%3Dnosim\/simplebits-20\/103-3259347-6540641\" title=\"Buy Web Standards Solutions at Amazon\"><cite>Web Standards Solutions: The Markup and Style Handbook<\/cite><\/a>. It\u00e2\u0080\u0099s an excellent reference for such questions.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The question arose at the office last week, \u00e2\u0080\u009cis there a best practice on using the title attribute on the &#60;a&#62; vs. &#60;img&#62; tags when the link wraps the image?\u00e2\u0080? With so many attributes available it can be confusing to know which ones to use when. The title attribute tells you where a link is [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-6","post","type-post","status-publish","format-standard","hentry","category-code"],"_links":{"self":[{"href":"http:\/\/markup.thekraemers.com\/index.php?rest_route=\/wp\/v2\/posts\/6","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/markup.thekraemers.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/markup.thekraemers.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/markup.thekraemers.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/markup.thekraemers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6"}],"version-history":[{"count":0,"href":"http:\/\/markup.thekraemers.com\/index.php?rest_route=\/wp\/v2\/posts\/6\/revisions"}],"wp:attachment":[{"href":"http:\/\/markup.thekraemers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/markup.thekraemers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/markup.thekraemers.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}