<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Webdesign, CSS, Social Media, Tech &#38; Geek Stuff &#187; IE6</title>
	<atom:link href="http://www.mr-mojo-risin.net/tag/ie6/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mr-mojo-risin.net</link>
	<description>Web news, CSS and HTML tweaks, social media marketing and blog resources, geeky gadgets, mind blowing graphic sites...</description>
	<lastBuildDate>Fri, 15 Jul 2011 13:18:29 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>CSS Mouse Over Opacity Effect</title>
		<link>http://www.mr-mojo-risin.net/2008/11/04/css-mouse-over-opacity-effect/</link>
		<comments>http://www.mr-mojo-risin.net/2008/11/04/css-mouse-over-opacity-effect/#comments</comments>
		<pubDate>Tue, 04 Nov 2008 16:15:23 +0000</pubDate>
		<dc:creator>mr-mojo-risin</dc:creator>
				<category><![CDATA[advanced]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[background]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[chrome]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[div]]></category>
		<category><![CDATA[effect]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[graphic]]></category>
		<category><![CDATA[hint]]></category>
		<category><![CDATA[IE6]]></category>
		<category><![CDATA[IE6 hack]]></category>
		<category><![CDATA[IE7]]></category>
		<category><![CDATA[Mouse Over]]></category>
		<category><![CDATA[mouseover]]></category>
		<category><![CDATA[Opacity]]></category>
		<category><![CDATA[opera]]></category>
		<category><![CDATA[transparency]]></category>
		<category><![CDATA[trick]]></category>

		<guid isPermaLink="false">http://www.mr-mojo-risin.net/?p=52</guid>
		<description><![CDATA[Generally this is no rocket science, using the CSS3 attribute &#8220;opacity&#8221;, unfortunately CSS3 is not supported by many browsers. As an alternative one could use JavaScript, which also might not work everywhere (if disabled due to security measures). So the easy way only works in the latest versions of Firefox and Opera. (Take a look [...]]]></description>
			<content:encoded><![CDATA[<p>Generally this is no rocket science, using the CSS3 attribute &#8220;opacity&#8221;, unfortunately CSS3 is not supported by many browsers. As an alternative one could use JavaScript, which also might not work everywhere (if disabled due to security measures). So the easy way only works in the latest versions of Firefox and Opera.</p>
<p><a href="http://www.mr-mojo-risin.net/css-demo_001/css-demo_001.html"><img title="CSS Mouse Over Opacity Effect | css demo 01 image" src="http://www.mr-mojo-risin.net/wp-content/uploads/2008/10/css-demo_01.jpg" alt="css demo 01 CSS Mouse Over Opacity Effect" width="400" height="172" /></a></p>
<div class="cl"></div>
<p>(Take a look at a live demo <a title="CSS Mouse Over Opacity Demo" href="http://www.mr-mojo-risin.net/css-demo_001/css-demo_001.html" target="_blank">here</a>)</p>
<p>In order to get this working in all the browsers (Ok, using IE6 we&#8217;ll have to trick a little bit, but we&#8217;ll discuss this later) we have to approach this in a sneaky way.<br />
Here is a simple, fast, lean, cross browser functional and JavaScript free method, only using plain HTML, CSS and graphical elements:</p>
<p><span id="more-52"></span></p>
<p>First of all we need graphical elements, for this example only four are needed, five if including the IE6 hack:</p>
<ul>
<li>2 images of your choice to be linked</li>
<li>one graphic with transparency and color of your choice in the same size as the linked images</li>
<li>one 1px x 1px full transparent GIF</li>
</ul>
<p>You might want to download the whole demo <a title="CSS Mouse Over Opacity Demo" href="http://www.mr-mojo-risin.net/css-demo_001/demo.zip">here</a>, there the graphics are included.</p>
<p>First create the div containers including the picture links in the html document, assign a class called &#8220;image&#8221; and determine the background image, which shall be linked, by using the &#8220;style&#8221; attribute.</p>
<div class="code-example">
<pre>
&lt;div class="image"
style="background-image: url(product_01.jpg);" &gt; &lt;/div&gt;

&lt;div class="image"
style="background-image: url(product_02.jpg);" &gt; &lt;/div&gt;
</pre>
</div>
<p>[Integrating the images via "style" might be avoided by assigning "id" and referencing the image url in the css, but I needed the image to referenced in the html code for dynamic site and did not want to use the "img" tag for reasons] </p>
<p><SCRIPT charset="utf-8" type="text/javascript" src="http://ws.amazon.com/widgets/q?ServiceVersion=20070822&#038;MarketPlace=US&#038;ID=V20070822/US/mrmojorisin-20/8001/f5bc83ca-9b61-4194-b550-a5e8962794dd"> </SCRIPT> <NOSCRIPT><A HREF="http://ws.amazon.com/widgets/q?ServiceVersion=20070822&#038;MarketPlace=US&#038;ID=V20070822%2FUS%2Fmrmojorisin-20%2F8001%2Ff5bc83ca-9b61-4194-b550-a5e8962794dd&#038;Operation=NoScript">Amazon.com Widgets</A></NOSCRIPT></p>
<p>After that add the links, define them using &#8220;class=&#8221;picture&#8221;, linkpath and further attributes like &#8220;title&#8221;. it should look somewhat like this:</p>
<div class="code-example">
<pre>
&lt;div class="image"
style="background-image: url(product_01.jpg);" &gt;
&lt;a href="[path]" class="picture" title="linktitle" &gt; &lt;/a&gt;
&lt;/div&gt;

&lt;div class="image"
style="background-image: url(product_02.jpg);" &gt;
&lt;a href="[path]" class="picture" title="linktitle" &gt; &lt;/a&gt;
 &lt;/div&gt;
</pre>
</div>
<p>Now the css, only two classes (+ one pseudo class) are needed:</p>
<p><strong>.image:</strong><br />
It must at least contain &#8220;background-repeat: no-repeat; border: none;&#8221; or modifications if wanted.</p>
<p><strong>a.picture</strong><br />
The size of the linked picture and the attribute &#8220;display:block;&#8221; must be indicated. The image-url for the non-active link is indicated as &#8220;background-image&#8221;, too</p>
<p><strong>a.picture:hover</strong><br />
Here the image-url for the active link is defined.</p>
<p>Now the .css file should contain the following:</p>
<div class="code-example">
<pre>
a.picture {
background: url(opacity_01.png) no-repeat;
width:183px;
height:146px;
display:block;}

a.picture:hover {
background: url(blank_01.gif) repeat;}

.image{
background-repeat: no-repeat;
border: none;}
</pre>
</div>
<p>Now you just need to align the two div containers properly as you like them to be.<br />
In this example they are floating with a margin of 10 pixels, which is done by two additional classes &#8220;l&#8221; and &#8220;m&#8221;. Why it is separated from the &#8220;image&#8221; class is explained <a href="http://www.mr-mojo-risin.net/2008/07/13/css-basic-hints/">here</a>.</p>
<p><strong>Attention!</strong></p>
<p>This works properly in every browser, but in not IE6, because here only full transparency is supported.<br />
So here&#8217;s the IE6 hack:</p>
<p>First create a new .css file named &#8220;ie6.css&#8221;, then add the following lines between the &lt;head&gt; tags of your html file:</p>
<div class="code-example">
<pre>
&lt;!--[if IE 6]&gt;
&lt;style type="text/css"&gt;@import url(ie6.css);&lt;/style&gt;
&lt;![endif]--&gt;
</pre>
</div>
<p>After that you refer to an image using only full transparency in the &#8220;a.picture&#8221; class in the &#8220;ie6.css&#8221; file, somewhat like that:</p>
<div class="code-example">
<pre>
a.picture {background: url(opacity_ie6_01.gif) no-repeat;}
</pre>
</div>
<p>&#8230;and you are done!</p>
<div class="tweetmeme_button" style="float: left; margin-right: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.mr-mojo-risin.net%2F2008%2F11%2F04%2Fcss-mouse-over-opacity-effect%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.mr-mojo-risin.net%2F2008%2F11%2F04%2Fcss-mouse-over-opacity-effect%2F&amp;source=mrmojorisin&amp;style=compact&amp;service=bit.ly&amp;service_api=R_47f1cccea29760eee97be5cf0ad3e3f7&amp;hashtags=background,browser,chrome,code,css,div,effect,firefox,graphic,hint,IE6,IE6+hack,IE7,Mouse+Over,mouseover,Opacity,opera,transparency,trick&amp;b=2" height="61" width="50" title="CSS Mouse Over Opacity Effect |  image" alt=" CSS Mouse Over Opacity Effect" /><br />
			</a>
		</div>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.mr-mojo-risin.net%2F2008%2F11%2F04%2Fcss-mouse-over-opacity-effect%2F&amp;title=CSS%20Mouse%20Over%20Opacity%20Effect" id="wpa2a_2"><img src="http://www.mr-mojo-risin.net/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="share save 171 16 CSS Mouse Over Opacity Effect"  title="CSS Mouse Over Opacity Effect | share save 171 16 image" /></a></p> <p><a href="http://www.mr-mojo-risin.net/?flattrss_redirect&amp;id=52&amp;md5=61ed58fc9eea0be7c75b10d2e07eedbd" title="Flattr" target="_blank"><img src="http://www.mr-mojo-risin.net/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.mr-mojo-risin.net/2008/11/04/css-mouse-over-opacity-effect/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" href="http://www.mr-mojo-risin.net/?flattrss_redirect&amp;id=52&amp;md5=61ed58fc9eea0be7c75b10d2e07eedbd" type="text/html" />"
	</item>
	</channel>
</rss>

