<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
    xmlns:admin="http://webns.net/mvcb/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:content="http://purl.org/rss/1.0/modules/content/">

    <channel>
    
    <title>Eli Van Zoeren: Blog</title>
    <link>http://elivz.com//blog/index/</link>
    <description></description>
    <dc:language>en</dc:language>
    <dc:rights>Copyright 2008 by Eli Van Zoeren</dc:rights>
    <dc:date>2008-08-01T20:49:54-05:00</dc:date>
    <admin:generatorAgent rdf:resource="http://expressionengine.com/" />
    

    <item>
      <title>Are people really convinced by this?</title>
      <link>http://www.elivz.com/feeder/?FeederAction=clicked&amp;feed=Blog+Feed&amp;seed=http%3A%2F%2Felivz.com%2Fblog%2Fsingle%2Fare_people_really_convinced_by_this%2F&amp;seed_title=Are+people+really+convinced+by+this%3F</link>
      <guid>http://elivz.com/blog/single/are_people_really_convinced_by_this/</guid>
      <description><![CDATA[<p>This election is getting <a href="http://www.johnmccain.com/Informing/Multimedia/Player.aspx?guid=848322d6-92fe-403e-9cc7-85b6b3ee4011" title="Celeb" TV ad">more</a> and <a href="http://online.wsj.com/article_email/SB121755336096303089-lMyQjAxMDI4MTA3MTUwNTEzWj.html" title="Too Fit to Be President?">more</a> <a href="http://www.johnmccain.com/Informing/Multimedia/Player.aspx?guid=779c7d13-7d76-47a5-a4cd-e928e8f1f1d6" title=""The One" TV ad">ridiculous</a>.
</p>]]>}</description>
      <dc:subject>Politics</dc:subject>
      <dc:date>2008-08-01T20:49:54-05:00</dc:date>
    </item>

    <item>
      <title>Elevated initial caps with jQuery</title>
      <link>http://www.elivz.com/feeder/?FeederAction=clicked&amp;feed=Blog+Feed&amp;seed=http%3A%2F%2Felivz.com%2Fblog%2Fsingle%2Finitial_caps%2F&amp;seed_title=Elevated+initial+caps+with+jQuery</link>
      <guid>http://elivz.com/blog/single/initial_caps/</guid>
      <description><![CDATA[<p>For a project I am currently working on I wanted to use elevated initial capitals to set off each block of text. The obvious way to do this would have been with the <code><a href="http://reference.sitepoint.com/css/pseudoelement-firstletter">:first-letter</a></code> pseudo-element, which is what I initially did. This worked great in Safari, but in Internet Explorer, I got a series of bugs and idiosyncrasies that eventually became more trouble than they were worth. Line spacing was alternately too loose or too tight, depending on what I did, and in IE6 it interacted with the <a href="http://code.google.com/p/ie7-js/">IE7-js</a> script to make all but the first paragraph tiny.
</p>
<p>
So I turned to jQuery to wrap the first letter of the first paragraph with a <code>&lt;span&gt;</code> tag that I could style however I wanted. I found inspiration for this script on the <a href="http://www.learningjquery.com/2006/10/fancy-drop-cap-part-2">Learning jQuery</a> website, but I couldn&#8217;t find a pre-made script that would do exactly what I needed. So here is my script, hopefully it will help someone else out.
</p>
<h4>Stylesheet</h4>
<p><code>.init-cap {
<br />
&nbsp;font-size: 1.5em;  /* Set the size of the raised letter */
<br />
&nbsp;line-height: 1.2em;  /* Adjust the line spacing to match the rest of the text */
<br />
&nbsp;}</code></p>

<h4>Javascript</h4>
<p><code>$(document).ready(function() {
<br />
&nbsp;$(&#8217;.cap p:first&#8217;).each(function() {
<br />
&nbsp;&nbsp;var text = $(this).html();
<br />
&nbsp;&nbsp;var first_letter = text.substr(0,1);
<br />
&nbsp;&nbsp;if ( /[a-zA-Z]/.test(first_letter) ) {
<br />
&nbsp;&nbsp;&nbsp;$(this).html(&#8217;&lt;span class="init-cap"&gt;&#8217; + first_letter + &#8216;&lt;/span&gt;&#8217; + text.slice(1));
<br />
&nbsp;&nbsp;}
<br />
&nbsp;}); 
<br />
});</code></p>

<p>
What we are doing is selecting the first paragraph inside each element with the class &#8220;cap&#8221; applied to it. We then chop the first letter off that paragraph, check to be sure it is really a letter (rather than a tag, for instance), and add it back on wrapped inside a <code>&lt;span&gt;</code> tag. By adjusting the CSS, this could easily be used for drop-caps, as well.
<br />

</p>]]>}</description>
      <dc:subject>jQuery, Web design</dc:subject>
      <dc:date>2008-07-02T19:44:38-05:00</dc:date>
    </item>

    <item>
      <title>Photoblog updates</title>
      <link>http://www.elivz.com/feeder/?FeederAction=clicked&amp;feed=Blog+Feed&amp;seed=http%3A%2F%2Felivz.com%2Fblog%2Fsingle%2Fphotoblog_updates%2F&amp;seed_title=Photoblog+updates</link>
      <guid>http://elivz.com/blog/single/photoblog_updates/</guid>
      <description><![CDATA[<p>I finally had time today to migrate the &#8220;Photography&#8221; section of my website over to the Expression Engine system that I am using for the rest of the site. So now everything is under one roof, with the same interface for uploading photos as for writing blog posts. Everything looks and works more or less the same, but it is easier for me to maintain.
</p>
<p>
I have been using <a href="http://www.pixelpost.org/">PixelPost</a> for my photoblog for nearly two years, since I got tired of the size limit of photos in Blogger. PixelPost always served me well, and as a purpose-built photoblog package, it can&#8217;t be beat. However, it has suffered from a (seeming) lack of developer attention lately, and is now showing it&#8217;s age.
</p>
<p>
<a href="http://elivz.com/photo/"><img src="http://elivz.com/images/uploads/photoblog.jpg" alt="Photoblog screenshot" class="img_med" /></a>Since there is no native export functionality in PixelPost, I had to write a custom script to dump the database into the MoveableType export format that EE will import. That worked pretty well, although there were a few things I had to go in and fix by hand. When I have some spare time, I will try to clean up the script and make it available for anyone in my situation. (Or contact me if you want a copy of the file to play with.)
</p>
<p>
If you were subscribed to my photography RSS feed, please update your subscriptions to the new link: <a href="http://elivz.com/photo/feed/">http://elivz.com/photo/feed/</a>. It should redirect the old address, but I may not keep the redirect active forever.
</p>
<p>
Hope you enjoy! I am going up to Portland, ME tomorrow, so I should have some new photos to post, as well.
</p>
]]>}</description>
      <dc:subject>Expression Engine, Web design, Photography</dc:subject>
      <dc:date>2008-05-30T01:16:00-05:00</dc:date>
    </item>

    <item>
      <title>Return to Durham</title>
      <link>http://www.elivz.com/feeder/?FeederAction=clicked&amp;feed=Blog+Feed&amp;seed=http%3A%2F%2Felivz.com%2Fblog%2Fsingle%2Freturn_to_durham%2F&amp;seed_title=Return+to+Durham</link>
      <guid>http://elivz.com/blog/single/return_to_durham/</guid>
      <description><![CDATA[<p>I am going to be back in Durham from June 3rd through the 14th. To anyone who will be there, let&#8217;s get together!
</p>
<p>
<a href="http://www.amandavs.com">Amanda</a> has some final scanning and printing of photos to do at Duke in preparation for her show in August. I will also be working on some design projects, but I expect to have plenty of free time. So give me a call, we&#8217;ll have a drink on my porch, go for a walk, or you can make me dinner (all of our dishes and cookware will still be here in Somerville).
</p>]]>}</description>
      <dc:subject>Personal</dc:subject>
      <dc:date>2008-05-28T15:49:01-05:00</dc:date>
    </item>

    <item>
      <title>Inline image replacement</title>
      <link>http://www.elivz.com/feeder/?FeederAction=clicked&amp;feed=Blog+Feed&amp;seed=http%3A%2F%2Felivz.com%2Fblog%2Fsingle%2Finline_image_replacement%2F&amp;seed_title=Inline+image+replacement</link>
      <guid>http://elivz.com/blog/single/inline_image_replacement/</guid>
      <description><![CDATA[<p>You may have noticed the very last line on this website, crediting the <a href="http://expressionengine.com">cms</a> and <a href="http://www.webfaction.com">host</a> I am using. It turned out to be much more difficult to make that effect work than I was expecting, so I thought I would explain my code for anyone else who needs to do something similar.
</p>
<p>
The easiest solution would have been to use an <code>&lt;img /&gt;</code> tag in the flow of the text. There were two problems with this: The first is my philosophical issue with using an image tag when semantically I want text. The second problem is making the image change color when the user hovers their mouse over it, like all the other links on the page. Of course I could have set up and onMouseOver script that would switch the images, but I didn&#8217;t like that, either. The classic image-replacement trick of saving both the normal and the &#8220;hot&#8221; images in one file and then adjusting the <code>background-image-position</code> in css is so much faster and more elegant.
</p>
<p>
So I started looking at image replacement techniques. Unfortunately, all the standard methods require the replaced image to be a block-level element. This obviously won&#8217;t work in my case, since it would put each image on a separate line. With a bit of experimentation, I found a method that allows me to keep the replaced image as an inline element, keeps the link and tooltip active, and even lets me underline the image on mouseover, just like a normal link.
</p>
<h4>First try</h4>
<p>
I am going to be working with this xHTML for my first experiments:
</p>
<p><code>&lt;p&gt;This is a line of text with a &lt;a class="replaced" id="butterfly"&gt;butterfly&lt;/a&gt; in the middle.&lt;/p&gt;</code></p>

<p>
I want to replace the word butterfly with an image of a butterfly: <img src="http://elivz.com/images/uploads/butterfly.png" alt="Butterfly image" />
</p>
<p>
There is a CSS <code>position</code> property called &#8220;inline-block&#8221; that would seem to combine the necessary qualities of both &#8220;inline&#8221; positioning&mdash;keeping the replaced image inside the flow of text&mdash;and &#8220;block&#8221; positioning&mdash;creating a defined space that an image can be placed in. And it does, except that it is not part of the CSS specification and Firefox doesn&#8217;t support it. However, Firefox does support their own implementation, called &#8220;-moz-inline-box&#8221;. So combining those with the standard image-replacement code, we get:
</p>
<p><code>
<br />
.replaced {
<br />
	display: inline-block;
<br />
	display: -moz-inline-box;
<br />
	background-repeat: no-repeat;
<br />
	background-position: 0 0;
<br />
	overflow: hidden;
<br />
	text-indent: -9999px;
<br />
}
<br />
#butterfly {
<br />
	width: 22px;
<br />
	height: 18px;
<br />
	background: url(butterfly.png) no-repeat;
<br />
}
<br />
</code></p>

<p>
Which gives us:
</p>
<p>
<style type="text/css">#example-1 { display: inline-block; display: -moz-inline-box; overflow: hidden; text-indent: -9999px; width: 22px; height: 18px; background: url(http://elivz.com/images/uploads/butterfly.png) no-repeat 0 0; }</style>This is a line of text with a <a id="example-1">butterfly</a> in the middle.
</p>
<p>
That&#8217;s close&mdash;the image shows up in the middle of the sentence, as desired, but in Firefox and IE the image is still overlaid with text.
</p>
<h4>Second Try</h4>
<p>
Adding two new rules to the stylesheet will make it work in Firefox:
</p>
<p><code>.replaced {
<br />
	display: inline-block;
<br />
	display: -moz-inline-box;
<br />
	background-repeat: no-repeat;
<br />
	background-position: 0 0;
<br />
	overflow: hidden;
<br />
	text-indent: -9999px;
<br />
	font-size: 0;
<br />
	vertical-align: text-top;
<br />
}</code></p>

<p>
<style type="text/css">#example-2 { display: inline-block; display: -moz-inline-box; overflow: hidden; text-indent: -9999px; font-size: 0; vertical-align: text-top; width: 22px; height: 18px; background: url(http://elivz.com/images/uploads/butterfly.png) no-repeat 0 0; } </style>This is a line of text with a <a id="example-2">butterfly</a> in the middle.
</p>
<p>
But Internet Explorer, the bad boy of the browser world, only shows a little glob at the top of where the image should be. Fortunately, my default solution to all IE bugs works in this case. Adding <code>zoom: 1</code> gives the image &#8221;<a href="http://www.satzansatz.de/cssd/onhavinglayout.html">layout</a>&#8221; and causes it to re-appear. (Incidentally, both <code>display: inline-block</code> and setting the dimensions should trigger hasLayout, but for some reason they don&#8217;t in this case.) <code>Zoom</code> is a Microsoft proprietary extension to CSS, so it won&#8217;t validate, but neither will <code>display: -moz-inline-box</code>. If that bothers you, move them to alternate style sheets&hellip;I&#8217;m not too worried about it.
</p>
<h4>Underlining on hover</h4>
<p>
On my site, like many others, an line appears under links when you place your mouse over them. Since I wanted to directly replace the text in my sentence with an image, it would make sense that it would also have the underline. If you have a rule in your stylesheet for <code>a:hover</code> already, the image-replaced link will inherit it automatically, but the line will be directly under the image rather than a few pixels lower like it would be with normal text. So I add some padding to the bottom on hover. I also adjust the background position to show the second, hightlighted, image that is below the normal one.
</p>
<p><code>#butterfly:hover {
<br />
	background-position: 0 -18px;
<br />
	border-bottom: 1px solid;
<br />
	padding: 0 0 2px;
<br />
}</code></p>

<p>
<style type="text/css">#example-3 { display: inline-block; display: -moz-inline-box; overflow: hidden; text-indent: -9999px; font-size: 0; vertical-align: text-top; width: 22px; height: 18px; background: url(http://elivz.com/images/uploads/butterfly.png) no-repeat 0 0; } #example-3:hover { background-position: 0 -18px; border-bottom: 1px solid; padding: 0 0 2px; }</style>This is a line of text with a <a id="example-3">butterfly</a> in the middle.
</p>
<p>
Looks great, right? Except if you are using Firefox, which refuses to add the padding to the bottom. As reported by <a href="http://www.getfirebug.com/">Firebug</a>, Firefox actually decreases the height of the element to cancel out the added padding. Weird. The only solution I have found requires adding an extra <code>&lt;span&gt;</code>, which I generally avoid. I moved a number of CSS rules to the new span and added three extra rules. The line height of the span is set to the height of the image, to prevent it from showing part of the highlighted image below. Also, IE7 no longer shows the &#8220;hand&#8221; cursor, so I added a rule to fix that. Lastly, I added -3 pixels of margin to the bottom to offset the padding and border.
</p>
<p>
The final code is:
</p>
<p><code><p>&lt;p&gt;This is a line of text with a &lt;a class="replaced" id="butterfly"&gt;&lt;span&gt;butterfly&lt;/span&gt;&lt;/a&gt; in the middle.&lt;/p&gt;
</p>
<p>
.replaced {
<br />
	display: inline-block;
<br />
	display: -moz-inline-stack;
<br />
	background-repeat: no-repeat;
<br />
	background-position: 0 0;
<br />
	vertical-align: text-top;
<br />
	zoom: 1;
<br />
}
<br />
.replaced span {
<br />
	display: block;
<br />
	overflow: hidden;
<br />
	text-indent: -9999px;
<br />
	line-height: 18px;
<br />
	cursor: pointer;
<br />
}
<br />
#butterfly {
<br />
	width: 22px;
<br />
	background: url(butterfly.png) no-repeat;
<br />
}
<br />
#butterfly:hover {
<br />
	background-position: 0 -18px;
<br />
	border-bottom: 1px solid;
<br />
	padding-bottom: 2px;
<br />
	margin-bottom: -3px;
<br />
}</p></code>

<p>
And the final result is:
</p>
<p>
<style type="text/css">#example-4 { display: inline-block; display: -moz-inline-box; vertical-align: text-top; zoom: 1; width: 22px; background: url(http://elivz.com/images/uploads/butterfly.png) no-repeat 0 0; } #example-4 span { display: block; overflow: hidden; text-indent: -9999px; line-height: 18px; cursor: pointer; }   #example-4:hover { background-position: 0 -18px; border-bottom: 1px solid; padding-bottom: 2px; margin-bottom: -3px; }</style>This is a line of text with a <a id="example-4"><span>butterfly</span></a> in the middle.
<br />

</p>]]>}</description>
      <dc:subject>Web design</dc:subject>
      <dc:date>2008-05-22T21:54:00-05:00</dc:date>
    </item>

    <item>
      <title>The first post</title>
      <link>http://www.elivz.com/feeder/?FeederAction=clicked&amp;feed=Blog+Feed&amp;seed=http%3A%2F%2Felivz.com%2Fblog%2Fsingle%2Fthe_first_post%2F&amp;seed_title=The+first+post</link>
      <guid>http://elivz.com/blog/single/the_first_post/</guid>
      <description><![CDATA[<p>Welcome to the new EliVZ.com!
</p>
<p>
This is my new home on the internet, where I will be posting articles about web (and other kinds of) design, and some personal notes along the way as well. To begin with, I plan to write up some tips and things I learned in the course of creating this site&amp;mdashthere are a few you may find useful.
</p>
<p>
I still have a few things left to do to get this site looking its best. Some things are a little funky in Internet Explorer (particularly version 6, but you shouldn&#8217;t be using IE6 anyway). But I will get those cleaned up in the next few days.
</p>
<p>
In the mean time&hellip;have a look around. Check out my <a href="/portfolio/">portfolio</a>, <a href="/blog/feed/">subscribe</a> to my blog feed, <a href="/contact/">send me a note</a>.
</p>]]>}</description>
      <dc:subject>Web design, Personal</dc:subject>
      <dc:date>2008-04-22T17:43:00-05:00</dc:date>
    </item>

    
    </channel>
</rss>