{"id":2301,"date":"2015-11-01T07:56:51","date_gmt":"2015-11-01T15:56:51","guid":{"rendered":"http:\/\/www.wellgolly.com\/?p=2301"},"modified":"2016-03-10T17:25:32","modified_gmt":"2016-03-11T01:25:32","slug":"rollover-text-on-images","status":"publish","type":"post","link":"https:\/\/www.wellgolly.com\/?p=2301","title":{"rendered":"Rollover Text on Images"},"content":{"rendered":"<p>Here are two ways to do image rollovers. One is pure CSS and the other uses javascript. You can view them <a href=\"http:\/\/www.wellgolly.com\/Examples\/ImageRolloverTest\/\">here<\/a>.<\/p>\n<p>The CSS version uses a background image and the hover is a transparent png with just the text in it.<\/p>\n<p>The javascript version swaps out images on rollover and click.<\/p>\n<p><pre><code class=\"preserve-code-formatting\">\n&lt;style type=&quot;text\/css&quot;&gt;\n\n.image {\n&nbsp;&nbsp;&nbsp;&nbsp;height:300px;\n&nbsp;&nbsp;&nbsp;&nbsp;width:500px;\n&nbsp;&nbsp;&nbsp;&nbsp;display: block;\n&nbsp;&nbsp;&nbsp;&nbsp;float:left;\n&nbsp;&nbsp;&nbsp;&nbsp;clear: left;\n&nbsp;&nbsp;&nbsp;&nbsp;margin-top:20px;\n}\n\n.rollover img {\n&nbsp;&nbsp;&nbsp;&nbsp;opacity: 0;\n}\n\n.rollover img:hover {\n&nbsp;&nbsp;&nbsp;&nbsp;opacity: 1.0;\n}\n\n&lt;\/style&gt;\n\n&lt;div class=&quot;image&quot; style=&quot;background:url(Roscher_Photo_1.jpg);&quot;&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;a class=&quot;rollover&quot; href=&quot;&quot;&gt;&lt;img src=&quot;Roscher_Photo_1_Text.png&quot; alt=&quot;Rollover text&quot; \/&gt;&lt;\/a&gt;\n&lt;\/div&gt;\n\n&lt;div class=&quot;image&quot;&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;a href=&quot;Roscher_Photo_1.jpg&quot;\n&nbsp;&nbsp;&nbsp;&nbsp;onmouseover=&quot;if (document.images) document.imagename1.src=&#039;Roscher_Photo_1_Annotated.jpg&#039;;&quot;\n&nbsp;&nbsp;&nbsp;&nbsp;onmouseout=&quot;if (document.images)&nbsp;&nbsp;document.imagename1.src=&#039;Roscher_Photo_1.jpg&#039;;&quot;&gt;\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;img src=&quot;Roscher_Photo_1.jpg&quot; name=&quot;imagename1&quot;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;alt=&quot;Moving the cursor over the image will bring up an annotated version.\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Clicking on the image will bring up the highest resolution version available.&quot;&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/a&gt;\n&lt;\/div&gt;\n<\/code><\/pre><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here are two ways to do image rollovers. One is pure CSS and the other uses javascript. You can view them here. The CSS version uses a background image and the hover is a transparent png with just the text in it. The javascript version swaps out images on rollover and click. &lt;style type=&quot;text\/css&quot;&gt; .image &hellip; <a href=\"https:\/\/www.wellgolly.com\/?p=2301\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Rollover Text on Images<\/span><\/a><\/p>\n","protected":false},"author":6,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[28],"tags":[],"class_list":["post-2301","post","type-post","status-publish","format-standard","hentry","category-html-and-css"],"_links":{"self":[{"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=\/wp\/v2\/posts\/2301","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2301"}],"version-history":[{"count":0,"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=\/wp\/v2\/posts\/2301\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2301"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2301"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wellgolly.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2301"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}