<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Corrie Haffly &#187; CSS</title>
	<atom:link href="http://corriehaffly.wordpress.com/tag/css/feed/" rel="self" type="application/rss+xml" />
	<link>http://corriehaffly.wordpress.com</link>
	<description>This is my blog. I can be wordy. But I take really cute photos of kittens... er... babies, so it's all good.</description>
	<lastBuildDate>Tue, 01 Dec 2009 08:19:34 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='corriehaffly.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/d707102a8693e003ee17fb2b53535ffb?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Corrie Haffly &#187; CSS</title>
		<link>http://corriehaffly.wordpress.com</link>
	</image>
			<item>
		<title>Adventures in Transparency</title>
		<link>http://corriehaffly.wordpress.com/2007/03/29/adventures-in-transparency/</link>
		<comments>http://corriehaffly.wordpress.com/2007/03/29/adventures-in-transparency/#comments</comments>
		<pubDate>Thu, 29 Mar 2007 15:33:33 +0000</pubDate>
		<dc:creator>corriespondent</dc:creator>
				<category><![CDATA[Work and Design]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://corriehaffly.wordpress.com/2007/03/29/adventures-in-transparency/</guid>
		<description><![CDATA[Or, There&#8217;s a lot I still don&#8217;t know.
Or, There are no stupid questions, but lots of ignorant designers.
I&#8217;ve been working on web photo gallery templates like a madwoman and wanted to have an effect where the photo thumbnails are dim until you hover over them. There were other things about the specific layout I was [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=corriehaffly.wordpress.com&blog=883659&post=30&subd=corriehaffly&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><h3>Or, <em>There&#8217;s a lot I still don&#8217;t know.</em></h3>
<p><strong>Or, There are no stupid questions, but lots of ignorant designers.</strong></p>
<p>I&#8217;ve been working on web photo gallery templates like a madwoman and wanted to have an effect where the photo thumbnails are dim until you hover over them. There were other things about the specific layout I was working on that were new for me, as well &#8212; two that come to mind are working with transparent .pngs and trying to get them to work in IE6 and having slightly transparent text in certain areas. (Some other specifics about the project specs &#8212; the page had to work in IE6, IE7, FireFox 2, and Safari 1.5.)</p>
<p>Thank goodness for Google. Here are all the new things I&#8217;ve learned while working on these templates:</p>
<ul>
<li>How to use <a href="http://allinthehead.com/retro/289/sleight-update-alpha-png-backgrounds-in-ie">bgsleight.js</a> for transparent background images
<ul>
<li>How to get bgsleight to work so that you can click links in IE</li>
<li>That &#8220;stretched&#8221; images don&#8217;t look very good</li>
</ul>
</li>
<li>That <code>-khtml-opacity</code> even exists (and is necessary for some versions of Safari to have different opacity levels)</li>
<li>That IE&#8217;s <code>filter: alpha(...)</code> only works on objects that have &#8220;layout&#8221;</li>
</ul>
<p>Here are the specific details for my own reference, but maybe someone else may find it helpful&#8230;</p>
<p><span id="more-30"></span><strong>bgsleight.js adventures</strong></p>
<p>I&#8217;ve (infrequently) used this fix for <a href="http://homepage.ntlworld.com/bobosola/index.htm">transparent PNGs in IE5.5/6</a>. But with the layouts I was working on, I wanted to be able to have transparent PNG backgrounds as well. That&#8217;s where the <a href="http://allinthehead.com/retro/289/sleight-update-alpha-png-backgrounds-in-ie">bgsleight.js</a> code came in handy.</p>
<p>The code as it&#8217;s given will <strong>stretch </strong>the .png file out to fit the given area and will ignore any background-repeat properties that are set in the CSS. I&#8217;m fairly weak in Javascript/DOM-type stuff (have some books coming in from Amazon soon) so it took me longer than it probably should have to figure out how to get around it, and only after scrolling through many comments on the site.</p>
<p>So for my future reference:</p>
<ol>
<li>Change the following line of code to use &#8220;<strong>crop</strong>&#8221; instead of &#8220;scale&#8221;:<code>document.all[i].style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+mypng+"', sizingMethod='<strong>scale</strong>')";</code></li>
<li> Use an extra-big .png background image since you can&#8217;t have the image tile.</li>
</ol>
<p>Another thing about the bgsleight.js script is that it <strong>&#8220;disables&#8221; links</strong> in IE in the area that the background .png covers. Again, I found a solution to this in the comments:</p>
<p>Add <code>a { position: relative; }</code>. So far this hasn&#8217;t seemed to cause any other problems.</p>
<p>Okay, now I have transparent background images for IE6/7, FireFox, and Safari. Next!</p>
<p><strong>Transparent thumbnail images</strong></p>
<p>I got pretty frustrated yesterday because I had this CSS code and it <strong>wasn&#8217;t working in IE</strong> (worked great in FireFox). Neither the image thumbnail nor the text caption were even slightly transparent.</p>
<p><code>.thumbnail a:link, .thumbnail a:visited {<br />
-moz-opacity: .5;<br />
opacity: .5;<br />
filter: alpha(opacity=50);<br />
-khtml-opacity:50;<br />
}<br />
.thumbnail a:hover {<br />
-moz-opacity: 1;<br />
opacity: 1;<br />
filter: alpha(opacity=100);<br />
-khtml-opacity:100;<br />
}<br />
.caption {<br />
padding: 5px 0px;<br />
-moz-opacity: .7;<br />
opacity: .7;<br />
filter: alpha(opacity=70);<br />
-khtml-opacity:70;<br />
}</code></p>
<p><code>(</code>I should mention briefly that I didn&#8217;t even know -khtml-opacity existed before doing this. But I saw it in some existing code and wondered what it was for. <a href="http://www.webmasterworld.com/forum21/7905.htm">Turns out that it&#8217;s needed for Safari 1.1</a>. Who knew? Now I do. For this project I technically only needed this to work for Safari 1.5+, but I figured I might as well leave it in.)</p>
<p>Anyway, back to banging my head against IE. I don&#8217;t remember what combination of keywords finally pointed me to <a href="http://jszen.blogspot.com/2005/04/ie6-opacity-filter-caveat.html">this article</a>, but it informed me that alpha opacity only works on elements that have &#8220;layout&#8221; &#8212; most typically, elements that have a width/height, but could have any number of <a href="http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/haslayout.asp">hasLayout properties</a> set.</p>
<p>Making use of this new-found knowledge, I modified my CSS code to target the <code>img</code> instead of the <code>a</code> element, then added <code>zoom: 100%</code> to my <code>.caption</code> class. (There&#8217;s probably any number of ways to set one of the hasLayout properties; those just happened to be the ones I picked.)</p>
<p>Here&#8217;s my new code:</p>
<p><code><strong>.thumbnail a img</strong> {<br />
-moz-opacity: .5;<br />
opacity: .5;<br />
filter: alpha(opacity=50);<br />
-khtml-opacity:50;<br />
}<br />
<strong>.thumbnail a:hover img</strong> {<br />
-moz-opacity: 1;<br />
opacity: 1;<br />
filter: alpha(opacity=100);<br />
-khtml-opacity:100;<br />
}</code><code><br />
.caption {<br />
<strong>  zoom: 100%;</strong><br />
padding: 5px 0px;<br />
-moz-opacity: .7;<br />
opacity: .7;<br />
filter: alpha(opacity=70);<br />
-khtml-opacity:70;<br />
}</code></p>
<p><code></code>Finally, everything was working as I wanted it to!</p>
<p>(Those of you who are smarter than me&#8230; if you see any problems with the above code, PLEASE let me know!)</p>
<p>Update 3/30: Question &#8212; is <code>zoom: 100%</code> invalid? I didn&#8217;t run into problems at theW3C CSS Validator but this link mentions that <code>zoom </code>is MS-proprietary and will not validate. Will have to look into that more&#8230;</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/corriehaffly.wordpress.com/30/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/corriehaffly.wordpress.com/30/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/corriehaffly.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/corriehaffly.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/corriehaffly.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/corriehaffly.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/corriehaffly.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/corriehaffly.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/corriehaffly.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/corriehaffly.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/corriehaffly.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/corriehaffly.wordpress.com/30/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=corriehaffly.wordpress.com&blog=883659&post=30&subd=corriehaffly&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://corriehaffly.wordpress.com/2007/03/29/adventures-in-transparency/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/545adb30e80e93b8c37b0cf776808a03?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">corriespondent</media:title>
		</media:content>
	</item>
	</channel>
</rss>