<?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>Galen Grover - Connecticut Web Developer &#187; CSS</title>
	<atom:link href="http://www.galengrover.com/cat/web-development/css/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.galengrover.com</link>
	<description>Sometimes I write things</description>
	<lastBuildDate>Fri, 03 Sep 2010 18:12:02 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>CSS &amp; Javascript image preloader</title>
		<link>http://www.galengrover.com/web-development/css-javascript-image-preloader/</link>
		<comments>http://www.galengrover.com/web-development/css-javascript-image-preloader/#comments</comments>
		<pubDate>Tue, 23 Feb 2010 07:28:30 +0000</pubDate>
		<dc:creator>Galen</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.galengrover.com/?p=605</guid>
		<description><![CDATA[While building a photo gallery for a client I ran into an issue where the photos took too long to load and clicking thumbnails before all the photos loaded resulted in ugly transitions.

My solution was to put a semi-transparent &#8220;shield&#8221; (containing a loading animation) over the gallery. The user will be able to see the [...]]]></description>
			<content:encoded><![CDATA[<p>While building a photo gallery for a client I ran into an issue where the photos took too long to load and clicking thumbnails before all the photos loaded resulted in ugly transitions.</p>

<p>My solution was to put a semi-transparent &#8220;shield&#8221; (containing a loading animation) over the gallery. The user will be able to see the images loading, but will be unable to click anything until all images are loaded and the shield is hidden. <a href="http://dev.jtallman.com/portfolio/view/12/colonial_new_construction_westport_ct/#photo12">Here&#8217;s</a> the finished product.</p>

<p>Explanation follows the code.</p>

<p>Here&#8217;s the html. This goes inside the div that contains your gallery.</p>


<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;div id=&quot;gallery_loader&quot;&gt; &lt;!-- wrapper for shield --&gt;
    &lt;div&gt;&lt;/div&gt; &lt;!-- this is the actual shield --&gt;
    &lt;img src=&quot;animated_loader.gif&quot;&gt;&lt;!-- image preloader --&gt;
&lt;/div&gt;</pre></div></div>




<p>&#8230;and the CSS:</p>


<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#gallery_loader</span> <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span><span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* Position the wrapper at the top left corner */</span>
    <span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;"><span style="color: #cc66cc;">100</span>%</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* cover the entire width of your gallery */</span>
    <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span><span style="color: #933;"><span style="color: #cc66cc;">100</span>%</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* cover the entire height of your gallery */</span>
    <span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span><span style="color: #993333;">hidden</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* hide anything that might overflow */</span>
    <span style="color: #000000; font-weight: bold;">z-index</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">999</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* make sure the shield is on top over everything */</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#gallery_loader</span> div <span style="color: #00AA00;">&#123;</span> <span style="color: #808080; font-style: italic;">/* the actual shield */</span>
    <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span><span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* Position the shield at the top left corner of the wrapper */</span>
    <span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;"><span style="color: #cc66cc;">100</span>%</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* Take up the entire wrapper */</span>
    <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span><span style="color: #933;"><span style="color: #cc66cc;">100</span>%</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* Take up the entire wrapper */</span>
    <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#fff</span><span style="color: #00AA00;">;</span>
    opacity<span style="color: #00AA00;">:</span> .8<span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* .8 = 80% opacity for all non-ie browsers*/</span>
    -ms-filter<span style="color: #00AA00;">:</span><span style="color: #ff0000;">&quot;progid:DXImageTransform.Microsoft.Alpha(Opacity=80)&quot;</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* This and the next style are for IE */</span>
    filter<span style="color: #00AA00;">:</span> alpha<span style="color: #00AA00;">&#40;</span>opacity<span style="color: #00AA00;">=</span><span style="color: #cc66cc;">80</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#gallery_loader</span> img <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span><span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span><span style="color: #993333;">block</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* Need this so we can center the image */</span>
    <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">150px</span> <span style="color: #993333;">auto</span> <span style="color: #cc66cc;">0</span> <span style="color: #993333;">auto</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* Set this to whatever looks good */</span>
    <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">30px</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* Adjust to your needs */</span>
    <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#fff</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#333</span><span style="color: #00AA00;">;</span>
    -moz-border-radius<span style="color: #00AA00;">:</span><span style="color: #933;">5px</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* Round corners in mozilla browsers */</span>
    -webkit-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* Round corners for webkit browsers */</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>




<p>Put this inside an included javascript file. This will wait until the page is loaded entirely (images and all) and then fade the loader out. Requires jquery.</p>


<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span>window<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">bind</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;load&quot;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#gallery_loader'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">fadeOut</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>




<p>#gallery_loader is positioned absolutely and placed on top of everything else (z-index:999). It&#8217;s set to take up the entire width/height of its parent.  Next comes the shield that will actually do the &#8220;blocking&#8221; of everything in the gallery. The shield is opacited and set to take up the entire width/height of the wrapper. Finally the animated loading image is loaded and centered.</p>

<p>As you can tell from the HTML, the actual shield is not the container of the loading animation gif. This is because the children of transparent elements can&#8217;t be more opaque than their parents. In other words if we put the loading image inside the transparent &#8220;shield&#8221; (which has an opacity of 80%) it would have a max opacity of 80%. To fix this we put the &#8220;shield&#8221; underneath the loading image and opacitate it. <a href="http://www.quirksmode.org/css/opacity.html">Here&#8217;s</a> a good page on opacity.</p>



<p>Note: If you&#8217;re having issues where the loading gif isn&#8217;t loading immediately add this right after the opening of your body element</p>


<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;body&gt;
&lt;img src=&quot;animated_loader.gif&quot; style=&quot;display:none&quot;&gt;
...</pre></div></div>




<p>This will cause the loading gif to load first.</p>

<p><a href="http://www.ajaxload.info/">Here</a> is where i obtained my loading gif</p>]]></content:encoded>
			<wfw:commentRss>http://www.galengrover.com/web-development/css-javascript-image-preloader/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Button 1px &#8220;bug&#8221; in firefox</title>
		<link>http://www.galengrover.com/web-development/button-1px-bug-in-firefox/</link>
		<comments>http://www.galengrover.com/web-development/button-1px-bug-in-firefox/#comments</comments>
		<pubDate>Thu, 31 Dec 2009 18:40:13 +0000</pubDate>
		<dc:creator>Galen</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.galengrover.com/?p=562</guid>
		<description><![CDATA[When styling a button using the sliding doors technique i found that firefox shifted the span down 1px, thus foiling the entire idea of sliding doors.

To fix it use this:


button::-moz-focus-inner &#123; border: none;&#125;



]]></description>
			<content:encoded><![CDATA[<p>When styling a button using the sliding doors technique i found that firefox shifted the span down 1px, thus foiling the entire idea of sliding doors.</p>

<p>To fix it use this:</p>


<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">button<span style="color: #00AA00;">:</span><span style="color: #3333ff;">:-moz-focus-inner </span><span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span></pre></div></div>



]]></content:encoded>
			<wfw:commentRss>http://www.galengrover.com/web-development/button-1px-bug-in-firefox/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ridiculous IE6 bugs &#8211; Double margin &amp; Disappearing position:absolute near float</title>
		<link>http://www.galengrover.com/web-development/ridiculous-ie6-bugs-double-margin-disappearing-positionabsolute-near-float/</link>
		<comments>http://www.galengrover.com/web-development/ridiculous-ie6-bugs-double-margin-disappearing-positionabsolute-near-float/#comments</comments>
		<pubDate>Wed, 15 Jul 2009 20:39:41 +0000</pubDate>
		<dc:creator>Galen</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[ie6-bugs]]></category>

		<guid isPermaLink="false">http://www.galengrover.com/?p=464</guid>
		<description><![CDATA[Today while working on a layout I encountered 2 of IE&#8217;s more ridiculous bugs: Double margin &#038; Disappearing position:absolute near float.

Double Margin Bug
This occurs when you have a left-margin on a left-floated element, or a right margin on a right-floated element. The margin will randomly double for whatever reason.  Simplest way to fix it [...]]]></description>
			<content:encoded><![CDATA[<p>Today while working on a layout I encountered 2 of IE&#8217;s more ridiculous bugs: Double margin &#038; Disappearing position:absolute near float.</p>

<p><strong>Double Margin Bug</strong></p>
<p>This occurs when you have a left-margin on a left-floated element, or a right margin on a right-floated element. The margin will randomly double for whatever reason.  Simplest way to fix it is to put display:inline on the float</p>

<p><strong>Disapearing position:absolute near float</strong></p>
<p>I&#8217;m not sure of the exact circumstances for this bug, but if you have absolutely positioned elements disappearing and they are near floats you&#8217;ve probably stumbled onto it.  I can&#8217;t find a non-markup fix for this unfortunately.  The best fix I&#8217;ve found is to add an element between the absolutely positioned elements and the floats.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.galengrover.com/web-development/ridiculous-ie6-bugs-double-margin-disappearing-positionabsolute-near-float/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
