<?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>Skull Jackpot &#187; css</title>
	<atom:link href="http://skulljackpot.com/tagged-as/css/feed/" rel="self" type="application/rss+xml" />
	<link>http://skulljackpot.com</link>
	<description>Various thoughts of minimal interest to others</description>
	<lastBuildDate>Fri, 25 Feb 2011 16:22:46 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Process Peek: Community Almanac</title>
		<link>http://skulljackpot.com/2009/06/29/process-peek-community-almanac/</link>
		<comments>http://skulljackpot.com/2009/06/29/process-peek-community-almanac/#comments</comments>
		<pubDate>Mon, 29 Jun 2009 20:45:50 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
				<category><![CDATA[Process Peek]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[project]]></category>

		<guid isPermaLink="false">http://skulljackpot.com/?p=89</guid>
		<description><![CDATA[One of our current projects is a redesign for the Orton Family Foundation's <a href="http://communityalmanac.org">Community Almanac</a> site (I've mentioned it <a href="http://skulljackpot.com/2009/04/01/planting-carrots/">before</a>). The Orton Family Foundation was started by the folks who run the Vermont Country Store, and is particularly interested in preserving the stories and traditions of small-town America - something rapidly disappearing in the crush of homogenized, retail-franchise colonization efforts. I wanted to share a couple of peeks into the process for our upcoming redesign.]]></description>
			<content:encoded><![CDATA[<p>One of our current projects is a redesign for the Orton Family Foundation&#8217;s <a href="http://communityalmanac.org">Community Almanac</a> site. The Orton Family Foundation was started by the folks who run the Vermont Country Store, and is particularly interested in preserving the stories and traditions of small-town America &#8211; something rapidly disappearing in the crush of homogenized, retail-franchise colonization efforts. It&#8217;s a cool project, and <a href="http://theopenplanningproject.org">TOPP</a> had paired with them last year on launching a website to help gather and preserve the stories and information about a town&#8217;s distinctive character.</p>
<p>This spring, the Orton Family Foundation decided to have us revise the site, to help address some functional concerns, adapt to feedback from users, and refresh the look and feel. (Under-the-hood, we also migrated from Zope to Pylons). A key part of the aesthetic for the new design was really pushing the book metaphor as much as possible. I wanted to share a couple of peeks into how we incorporated that mandate into the new design. (For another take on this project, check out <a href="http://www.coactivate.org/projects/topp-engineering/blog/2009/06/26/almanac-update/">this writeup</a>).</p>
<p>For most pages, we ended up going with a very literal book metaphor:</p>
<div class="thumbnail"><a href="http://img.skitch.com/20090629-1e5dwsuqyynxxgrhm7q55ahwj1.jpg"><img src="http://img.skitch.com/20090629-1e5dwsuqyynxxgrhm7q55ahwj1.preview.jpg" alt="NewAlmanacStarksboro" /></a></div>
<p>For comparison, I&#8217;ve taken a shot of <a href="http://img.skitch.com/20090629-k34pbbrgm4t5531s6194aequuj.jpg">the original version</a>.</p>
<p>We had a hard time making the homepage fit the open-book design, and ultimately opted for a very different layout:</p>
<div class="thumbnail"><a href="http://img.skitch.com/20090629-pkbbrg1cuw9mm96eshf1m1f7ur.jpg"><img src="http://img.skitch.com/20090629-pkbbrg1cuw9mm96eshf1m1f7ur.preview.jpg" alt="NewAlmanacHome" /></a></div>
<p>The book metaphor carries over to the &#8220;stack&#8221; of almanacs, which are displayed edgewise. (For the sake of thoroughness, I&#8217;ve also posted <a href="http://img.skitch.com/20090629-px2ict4ykicqwrnbj59krdgbky.jpg">the previous Community Almanac homepage</a>).</p>
<h2>Fun with Error Pages</h2>
<p>Some of the most fun aspects of this project involved finding small ways to reinforce the book metaphor without being totally over the top, or working against the needs of an online application. Two of the pieces I&#8217;m particularly happy with are the error pages.</p>
<p>For the 404 (Not Found) page, we kicked around a couple of ideas, before hitting upon the idea of using the book image but with several pages torn out:</p>
<div class="thumbnail"><a href="http://img.skitch.com/20090629-d9khk7xxmasn39suki7u1kyfyy.jpg"><img src="http://img.skitch.com/20090629-d9khk7xxmasn39suki7u1kyfyy.preview.jpg" alt="NewAlmanac404" /></a></div>
<p>Once we&#8217;d come up with the design for the 404 page, the 500 (application error) page was a no-brainer:</p>
<div class="thumbnail"><a href="http://img.skitch.com/20090629-me6upa8kq7xk8bik4ftay3229.jpg"><img src="http://img.skitch.com/20090629-me6upa8kq7xk8bik4ftay3229.preview.jpg" alt="NewAlmanac500" /></a></div>
<p>Error pages in general don&#8217;t get a lot of design thought or attention, and these are probably the best error pages of any website I&#8217;ve gotten to work on. That&#8217;s not to say they&#8217;re the only interesting or cool element we&#8217;ve added to this relaunch &#8211; for bonus points, once the site launches this week, check out what happens when you turn the page.</p>
<p>In themselves, pieces like these are fairly minor. But nailing the details can help a good design become really great. We may not have been able to add every <a href="http://skulljackpot.com/2009/04/01/planting-carrots/">cool idea</a> in this iteration, but I&#8217;m pretty proud of the work our team has done, and am excited to see it go live this week.</p>
]]></content:encoded>
			<wfw:commentRss>http://skulljackpot.com/2009/06/29/process-peek-community-almanac/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Super CSS Selector Support with jQuery</title>
		<link>http://skulljackpot.com/2009/04/19/super-css-selector-support-with-jquery/</link>
		<comments>http://skulljackpot.com/2009/04/19/super-css-selector-support-with-jquery/#comments</comments>
		<pubDate>Sun, 19 Apr 2009 22:18:47 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
				<category><![CDATA[Under the hood]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[ie]]></category>
		<category><![CDATA[internet explorer]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[selector]]></category>

		<guid isPermaLink="false">http://skulljackpot.com/?p=61</guid>
		<description><![CDATA[Tired of having to add classes in your markup to work around lousy CSS selector support in legacy browsers? Try SuperSelectors - a jQuery plugin enabling great CSS selector support, even in IE6.]]></description>
			<content:encoded><![CDATA[<p>CSS provides a wide array of selectors to specify which elements should be subject to a particular style. CSS 2.1 gives web designers even more granularity when targeting specific elements. This is great in theory. But browser support for these selectors has lagged behind, and IE6 support is limited to only the most basic selectors. This has led to most folks working in the real world stashing the more advanced selectors away for rainy-day experimentation, or idle dreams about the eventual time when we can <em>use</em> these tools.</p>
<h2>Current State of Affairs</h2>
<p>Web folks are a clever bunch, though. If browser support for CSS won&#8217;t give us a way to target a particular element, a common solution is to make classes do the heavy lifting for us. Going through files to add <code>class="text"</code> to <strong>every</strong> text input is an all-too-common experience for web designers.</p>
<p>Adding the classes allows us to target elements on all browsers, but is labor-intensive and potentially error-prone. Moreover, if your site includes content (like comments or blog posts) which will entered by users, you have no easy way to ensure those classes are added appropriately.</p>
<h2>A Glimmer of Hope</h2>
<p>jQuery is one of several great javascript frameworks which have burst onto the scene in the past year or so. One of the reasons jQuery has gotten a lot of attention from web designers is the way it allows you to select elements &#8211; in many cases, jQuery selectors are <em>identical</em> to CSS selectors. jQuery is also extremely extensible. If there&#8217;s functionality you need which isn&#8217;t provided by the core framework, you can easily add it via a plugin (or by extending jQuery directly).</p>
<p>In the course of a recent project, I used jQuery to add a <code>first-child</code> class to some <code>&lt;li&gt;</code> elements in our top navigation, to shore up IE6 CSS support without having to alter the markup. After seeing how easy jQuery made that, I realized it&#8217;s be possible to write a plugin allowing <em>any</em> browser supported by jQuery capable of supporting <strong>all</strong> CSS 2.1 selectors. So I wrote SuperSelectors. It goes through your site&#8217;s stylesheets, dynamically adding classes to elements so that even IE6 can bask in the glow of properly supporting CSS selectors like <code>ul li:first-child li:nth-child(odd) a:hover</code>.</p>
<h2>Pencils out</h2>
<p>Before we can start to determine which elements ought to have classes added, we&#8217;ll need a way to access each stylesheet being used by a given page. Fortunately, the <code>document.styleSheets</code> array does exactly what we want. Unfortunately, we have to incur a little bit of overhead here. Since browsers will silently excise rules they don&#8217;t understand, we have to re-request the CSS files via javascript, and parse <em>those</em> for matches.</p>
<p>Now, the fact that jQuery supports CSS selector syntax comes in really handy. We can pass the matching CSS rules directly to jQuery, and add classes appropriately. Then, any browser supported by jQuery can properly target elements, even useful-but-not-broadly-supported CSS rules like <code>ul li:first</code>. All we need to do to have classes added to match any of the rules in our CSS is include jQuery and the SuperSelectors plugin, and add the following javascript:</p>
<pre>$(document).ready(function() {
  $(document).superSelectify();
});</pre>
<p>This is a great start, but some of us are maintaining sites with established conventions for element classnames. Maybe you&#8217;re working on an educational site, and the <code>child</code> is already reserved for another context. No problem. SuperSelectors will allow custom classes to be passed in, while still providing sensible defaults. You can override any (or all) of the default classnames. If you need to alter the class attached to child elements to be <code>child-element</code>, your javascript would just change to be:</p>
<pre>$(document).ready(function() {
  $(document).superSelectify({childClass: "child-element"});
});</pre>
<h2>Attribution needed</h2>
<p>What about special cases which fall outside the normal advanced selectors? Maybe we need to have styles applied conditionally, based on attributes. For example, maybe the links in your file download list should have an icon based on the extension of the file they&#8217;re pointing to. CSS 2.1 allows us to target elements based on attribute values &#8211; we can even match against substrings within the attribute value, which is a perfect fit for finding the file extensions of our links. The number of potential choices for attribute selectors alone is more than we can reasonably build into a single plugin, but fortunately SuperSelectors supports arbitrary selectors through the <code>additionalElementHash</code> attribute. This can be done with or without overriding the default classnames. A setup which addressed the file-type requirement mentioned above would look like this:</p>
<pre>$(document).ready(function() {
  $(document).superSelectify({additionalElementHash: {jpeg: 'a[href$=".jpg"]', pdf: 'a[href$=".pdf"]', doc: 'a[href$=".doc"]', gif: 'a[href$=".gif"]', xls: 'a[href$=".xls"]', png: 'a[href$=".png"]'}});
});</pre>
<p>A little more effort than the no-argument invocation, but that will enable matching almost any elements you can think of &#8211; you&#8217;re only limited by jQuery&#8217;s selector support, which is one of the best out there.</p>
<h2>Hovercraftiness</h2>
<p>It&#8217;s probably time to acknowledge the elephant in the room &#8211; specifically, the fact that IE6 only supports the <code>:hover</code> pseudo-selector for anchor tags. Through the years, there have been a variety of approaches to add this in, including Peter Nederlof&#8217;s <a href="http://www.xs4all.nl/~peterned/csshover.html">whatever:hover</a>. This is all well and good, but it&#8217;d be nice to be able to have one-stop shopping for all our CSS needs. Fortunately, jQuery makes it easy for us to add this functionality into Super Selectors. Declare your <code>:hover</code> rules normally, add an equivalent rule using the <code>hover</code> class, and SuperSelectors will take care of adding / removing the classnames from elements on mouseover.</p>
<h2>Faster, faster</h2>
<p>Things are really shaping up nicely. Any browser which jQuery supports can now use virtually any legitimate CSS selector, but we can still do better. If we know which advanced selectors our site will need to support, it seems wasteful to have to re-request all those CSS files, and then scan them for matches. In fact, on slow connections, or with sufficiently-large amount of CSS, users could see a page without the added classes for a fraction of a second, similar to the old <a href="http://en.wikipedia.org/wiki/Flash_of_unstyled_content">Flash of Unstyled Content</a> bug.</p>
<p>SuperSelectors makes it simple to avoid the unnecessary request/parsing overhead and display properly-classed markup right away. You just need to pass in all your selectors via the <code>manualSelectors</code> attribute, as a comma-delimited list. As with everything else, it can be used solo or in combination with any other arguments.:</p>
<pre>$(document).ready(function() {
  $(document).superSelectify({childClass: "child-element", manualSelectors: 'div.example > ul, ul.sample li:first, input[type="text"], input[type="password"]'}});
});</pre>
<p>For complex CSS needs, this may require a fair amount of work. However, this approach saves us from having to re-request and parse all the CSS files in use. Consequently, it will be <em>much</em> faster &#8211; especially for sites with large (or large numbers of) CSS files. <a href="http://sandbox.skulljackpot.com/superselectors/demo/">Check out the example</a>.</p>
<h2>One caveat</h2>
<p>SuperSelectors does a lot to help enable better CSS selector support across browsers, but it can&#8217;t do everything for us. We still need rules in our CSS which use the classes SuperSelectors will add.</p>
<p>Because Internet Explorer will discard the entire rule if it doesn&#8217;t understand one of the selectors, we do have to do a little duplication in our CSS. That means that, instead of</p>
<pre>div.example > ul,
div.example ul.child {
background: #0f0;
color: #f0f;
}</pre>
<p>You should write:</p>
<pre>div.example > ul {
background: #0f0;
color: #f0f;
}

div.example ul.child {
background: #0f0;
color: #f0f;
}</pre>
<h2>In Closing</h2>
<p>The goal of SuperSelectors is to make it possible for all of us to start using CSS 2.1 selectors in our everyday work. It doesn&#8217;t have CSS3 support (yet), but SuperSelectors will automatically benefit as jQuery adds support for CSS3 selectors.</p>
<p>You can download SuperSelectors as a <a href="http://github.com/chrispatterson/jquery-super-selectors/zipball/master">zip</a> or <a href="http://github.com/chrispatterson/jquery-super-selectors/tarball/master">tarball</a>. Github also hosts <a href="http://github.com/chrispatterson/jquery-super-selectors/tree/master">the official SuperSelectors repository</a>, if you&#8217;re interested in helping make SuperSelectors even better.</p>
]]></content:encoded>
			<wfw:commentRss>http://skulljackpot.com/2009/04/19/super-css-selector-support-with-jquery/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
		<item>
		<title>Right makes (Opera) wrong</title>
		<link>http://skulljackpot.com/2009/01/23/right-makes-opera-wrong/</link>
		<comments>http://skulljackpot.com/2009/01/23/right-makes-opera-wrong/#comments</comments>
		<pubDate>Sat, 24 Jan 2009 03:51:21 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
				<category><![CDATA[Under the hood]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[opera]]></category>
		<category><![CDATA[redraw]]></category>
		<category><![CDATA[renderbug]]></category>

		<guid isPermaLink="false">http://skulljackpot.com/?p=34</guid>
		<description><![CDATA[<p>In the course of redesigning <a href="http://theopenplanningproject.org/">the new TOPP website</a>, I ran into another odd renderbug which I wanted to document.</p>

<p>The design for the new site includes two drop-down menus (for "About Us" and "Our Work"), and we went with an approach based on the classic <a href="http://www.alistapart.com/articles/dropdowns">Suckerfish</a> menus. Pretty easy to implement, and looked great in our initial design passes. When I went to do some regression testing, I found that Opera was was badly misrendering the menus.</p>]]></description>
			<content:encoded><![CDATA[<p>In the course of redesigning <a href="http://theopenplanningproject.org/">the new TOPP website</a>, I ran into another odd renderbug which I wanted to document.</p>
<p>The design for the new site includes two drop-down menus (for &#8220;About Us&#8221; and &#8220;Our Work&#8221;), and we went with an approach based on the classic <a href="http://www.alistapart.com/articles/dropdowns">Suckerfish</a> menus. Pretty easy to implement, and looked great in our initial design passes. When I went to do some regression testing, I found that Opera was was badly misrendering the menus:</p>
<div class="thumbnail"><a href="http://skitch.com/dimmerswitch/67fd/opera-topp-menus-misrender"><img src="http://img.skitch.com/20090105-d7mnt8g3dyg2ewxuqrqf934g1c.preview.jpg" alt="opera-topp-menus-misrender" /></a></div>
<p>All other browsers were displaying the menus as-intended (even IE6, due to a quick little jQuery function to add the relevant classes on mouseover).</p>
<p>As I was playing with possible resolutions to the problem, I stumbled onto an odd fact. The problem <strong>only</strong> appeared when the nav was aligned to the right. Floating the nav to the right triggered the renderbug, as did positioning it to the right. Unfloated navs behaved correctly, as did ones which were floated or positioned left.</p>
<p>For launch, we went with a left-floated nav, but that prevents the nav from reliably being aligned with the right edge of the parent container (since font sizes can be adjusted independently of page zoom).</p>
<p>After launch, I did some digging to isolate the problem, and to write up a bug report for Opera. I also came up with a <a href="http://sandbox.skulljackpot.com/opera-redraw-renderbug/">test case</a> illustrating the issue.</p>
<p>The problem <strong>only</strong> manifests when the dropdown menus extend below the calculated bottom of the content within the <code>&lt;body&gt;</code> element. Since all the content on the TOPP site was floated, and floated elements are removed from the normal document flow, Opera effectively thought the pages were zero-height.</p>
<p>Somehow, floating or positioning the nav to the right is tripping up Opera&#8217;s redraw logic for the dropdown menus, if those dropdowns extend below the calculated bottom. <strong><em>Why</em></strong> right-floated or right-positioned elements trigger this renderbug, while left-floated or left-positioned elements behave correctly is still a bit of a mystery.</p>
<p>I&#8217;ve written up my test case and submitted a bug report to Opera. Opera unfortunately doesn&#8217;t have good transparency into their bug-tracking process, so I can&#8217;t link to my report, and folks can&#8217;t upvote the bug, but hopefully it&#8217;ll be fixed before too long.</p>
]]></content:encoded>
			<wfw:commentRss>http://skulljackpot.com/2009/01/23/right-makes-opera-wrong/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Design Pattern: Alpha transparency in IE without javascript</title>
		<link>http://skulljackpot.com/2009/01/22/design-pattern-alpha-transparency-in-ie-without-javascript/</link>
		<comments>http://skulljackpot.com/2009/01/22/design-pattern-alpha-transparency-in-ie-without-javascript/#comments</comments>
		<pubDate>Thu, 22 Jan 2009 20:34:28 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
				<category><![CDATA[Under the hood]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[pattern]]></category>

		<guid isPermaLink="false">http://skulljackpot.com/?p=75</guid>
		<description><![CDATA[Need to support alpha transparency in IE6? Try this CSS-only fix on for size.]]></description>
			<content:encoded><![CDATA[<p><em>Originally published on the <a href="http://www.openplans.org/projects/topp-design/blog/">TOPP Design Blog</a></em></p>
<h2>­Problem Summary</h2>
<p>An element needs to support partial transparency &#8211; either an <code>img</code> tag, or an element with the <code>background-image</code> property set via CSS.
</p>
<h3>Use When</h3>
<p>The page still needs to support IE6, and has elements which should be transparent.</p>
<h3>Solution</h3>
<p>Use CSS transparency, with appropriate selectors.</p>
<h3>Example</h3>
<div><a href="http://skitch.com/dimmerswitch/byst4/ie6-alpha-transparency"><img src="http://img.skitch.com/20090109-fubpcwp1gew5bd33s5r4968qgy.preview.jpg" alt="ie6-alpha-transparency" /></a>
</div>
<div><a href="http://skitch.com/dimmerswitch/bysu8/ie6-transparency-fix"><img src="http://img.skitch.com/20090109-ffsa1349jwpy63exywbm7gxcb7.preview.jpg" alt="ie6-transparency-fix" /></a>
</div>
<h4>CSS</h4>
<pre>* html .pngfix {
zoom: 1;
behavior: expression((this.runtimeStyle.behavior="none")&amp;&amp;(this.pngSet?this.pngSet=true:(this.nodeName == "IMG" &amp;&amp; this.src.toLowerCase().indexOf('.png')&gt;-1 ? (this.runtimeStyle.backgroundImage = "none", this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.src + "', sizingMethod='image')", this.src = "transparent.gif") : (this.origBg = this.origBg ? this.origBg : this.currentStyle.backgroundImage.toString().replace('url("','').replace('")',''), this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.origBg + "', sizingMethod='" + (this.currentStyle.backgroundRepeat=='no-repeat' ? 'crop' : 'scale') +"')", this.runtimeStyle.backgroundImage = "none")),this.pngSet=true));
}</pre>
<p><strong>Note</strong>: this method is adapted from the approach documented at <a href="http://www.komodomedia.com/blog/2007/11/css-png-image-fix-for-ie/">http://www.komodomedia.com/blog/2007/11/css-png-image-fix-for-ie/</a>. It improves upon it by using <code>zoom</code> to trigger HasLayout in IE6, rather than relying on <code>position: relative</code>.</p>
<p>You can either add the &#8220;pngfix&#8221; class to all elements which need to support transparency, or add selectors in your CSS file to target your desired elements. Prefixing the selectors with <code>* html</code> ensures that only IE6 will process the rule, preventing more-capable browsers from trying to parse IE AlphaImageLoader idiosyncrasies.</p>
<h4>Limitations</h4>
<p>This approach will not support repeated background-images &#8211; Internet Explorer will stretch the background image to fit. This can still be useful if your background is a solid color and you&#8217;re just using transparency for an overlay effect. It will also still be suitable if your background-image is full-width and has no vertical variation (for example, if you&#8217;re using a background image to fake columns).</p>
<p>Due to limitations with the AlphaImageLoader functionality, this approach will not work at all for elements which need to have the background image positioned. If that&#8217;s behavior you need (and you have to support transparency for IE6), you should consider adding an extra element and positioning <em>that</em> instead.</p>
]]></content:encoded>
			<wfw:commentRss>http://skulljackpot.com/2009/01/22/design-pattern-alpha-transparency-in-ie-without-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Design Pattern: Self-clearing floats</title>
		<link>http://skulljackpot.com/2009/01/08/design-pattern-self-clearing-floats/</link>
		<comments>http://skulljackpot.com/2009/01/08/design-pattern-self-clearing-floats/#comments</comments>
		<pubDate>Thu, 08 Jan 2009 21:12:54 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
				<category><![CDATA[Under the hood]]></category>
		<category><![CDATA[clear]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[float]]></category>
		<category><![CDATA[pattern]]></category>

		<guid isPermaLink="false">http://skulljackpot.com/?p=71</guid>
		<description><![CDATA[An all-CSS solution for clearing floated elements without extraneous markup.]]></description>
			<content:encoded><![CDATA[<p><em>Originally published on the <a href="http://www.openplans.org/projects/topp-design/blog/">TOPP Design Blog</a></em></p>
<h2>Problem Summary</h2>
<p>An element needs to be expanded to contain all child elements, one or more of which may be floated (and thus removed from the normal document flow). ­</p>
<h3>Use When</h3>
<p>The page contains floated elements w­hich should not extend beyond their parent element.</p>
<h3>Solution</h3>
<p>Use self-clearing floats.</p>
<h3>Rationale</h3>
<p>While the &#8220;use a float to contain a float&#8221; approach will ensure that all elements are appropriately contained, it can trigger other renderbugs which this approach avoids.</p>
<h3>Example</h3>
<div> <a href="http://skitch.com/dimmerswitch/bysyi/self-clearing-floats"><img src="http://img.skitch.com/20090109-t87ic6gce86xnudhd8f97che4p.preview.jpg" alt="self-clearing-floats" /></a>
</div>
<h4>CSS</h4>
<pre>.selfclear:after {
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}

.selfclear {
display: inline-block; /* IE 7 */
}

.selfclear {
display: block;
}

* html .selfclear {
height: 1px; /* IE &lt; 7 */
}</pre>
<p><strong>Note</strong>: this method builds upon the approach documented at <a href="http://positioniseverything.net/easyclearing.html">http://positioniseverything.net/easyclearing.html</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://skulljackpot.com/2009/01/08/design-pattern-self-clearing-floats/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Lessons from a white whale</title>
		<link>http://skulljackpot.com/2008/12/18/lessons-from-a-white-whale/</link>
		<comments>http://skulljackpot.com/2008/12/18/lessons-from-a-white-whale/#comments</comments>
		<pubDate>Fri, 19 Dec 2008 03:44:24 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
				<category><![CDATA[Under the hood]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[fencepost]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[renderbug]]></category>

		<guid isPermaLink="false">http://skulljackpot.com/?p=32</guid>
		<description><![CDATA[<p>I enjoy squashing renderbugs.</p>

<p>I don't always enjoy the midway point, when a misrendering issue stubbornly refuses to yield to my ministrations, but that "Eureka" moment where I manage to tease out what's going on under the hood and come up with a solution - that's gold.</p>

<p>As a result of the fact that Internet Explorer generally has the most rendering issues, I've gotten to be good pals with IE, in it's various incarnations. When presented with a new renderbug, I sometimes feel like a sitcom parent catching a child with their hand in the cookie jar. "Oh IE you goofball, what mischief have you gotten into <em>this</em> time..."</p>]]></description>
			<content:encoded><![CDATA[<p>I enjoy squashing renderbugs.</p>
<p>I don&#8217;t always enjoy the midway point, when a misrendering issue stubbornly refuses to yield to my ministrations, but that &#8220;Eureka&#8221; moment where I manage to tease out what&#8217;s going on under the hood and come up with a solution &#8211; that&#8217;s gold.</p>
<p>As a result of the fact that Internet Explorer generally has the most rendering issues, I&#8217;ve gotten to be good pals with IE, in it&#8217;s various incarnations. When presented with a new renderbug, I sometimes feel like a sitcom parent catching a child with their hand in the cookie jar. &#8220;Oh IE you goofball, what mischief have you gotten into <em>this</em> time&#8230;&#8221;</p>
<p>I know, I know. I should get out more. Bear with me.</p>
<p>Roughly two months after the new Livable Streets site launched, one of my co-workers reported a renderbug where the sidebar was one pixel out of place. After doing some detective work, I discovered that this issue was exceptional in two respects:</p>
<ol>
<li>It <strong>only</strong> showed up on Firefox 3. Earlier versions of Firefox were unaffected, as were Safari, Opera, <em>and Internet Explorer</em> (even IE 6).</li>
<li>It only showed up at certain horizontal resolutions. If you slowly resized the browser window in Firefox 3, you could watch the sidebar pop in and out of position.</li>
</ol>
<p>Based on the now-you-see-it, now-you-don&#8217;t behavior of the renderbug during viewport resize, I was pretty sure this had to be a rounding bug of some variety. When I dug into the CSS, I found that every element that could conceivably play a causal role had width, padding, and margin set in absolute pixel values.</p>
<p>I created and discarded a bunch of different solutions. Everything I came up with was either extremely fragile, or triggered worse misrenders. All my test cases failed to isolate the problem, or point in the direction of a viable fix. I inspected elements using the great <a href="http://chrispederick.com/work/web-developer/">Web Developer extension</a>. I added javascript to alert with element widths. At every step of the way, all elements reported the correct widths, yet I could trigger the bug at will by having an appropriately-sized browser window.</p>
<p>I began to jokingly refer to this renderbug as my &#8220;white whale&#8221;.</p>
<p>After a couple days of focused effort, with other projects starting to pile up, it became time to move on. I made a commit which fixed the worst symptoms of the misrender, but the underlying problem remained. I wasn&#8217;t happy about leaving the white whale out there, but couldn&#8217;t justify pushing off other front-burner issues to fix a one-pixel offset which affected a single browser, only at certain resolutions.</p>
<p>Fast-forward to last week. The market share for Firefox 3 has continued to climb. The design team has a bit of breathing room, and the white whale is once again in my sights. This time, though, I was able to identify the problem, and come up with a viable fix.</p>
<p>My initial reaction that this had to be a rounding error was correct, although I was looking in the wrong place by assuming the elements were being sized incorrectly. It turns out the the algorithms Firefox 3 uses for centering background images, can return <em>different</em> values from the ones used for centering contained elements. So, although all the elements on the page were sized in absolute pixels, the entire content area was being misaligned compared to the background-image (the background is centered on an element which is the full width of the viewport, so that at smaller browser sizes the dropshadow disappears and the content sits flush against the left side).</p>
<p>I created a test case demonstrating the issue, and went to post it to bugzilla, where I found multiple other users had already reported the problem. When I sat down to finish up this post, I found that the problem has already been fixed in the nightly builds, and should make it into production with Firefox 3.1.</p>
<p>Hooray for Open Source.</p>
]]></content:encoded>
			<wfw:commentRss>http://skulljackpot.com/2008/12/18/lessons-from-a-white-whale/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Inline Info</title>
		<link>http://skulljackpot.com/2008/11/24/inline-info/</link>
		<comments>http://skulljackpot.com/2008/11/24/inline-info/#comments</comments>
		<pubDate>Mon, 24 Nov 2008 23:43:04 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
				<category><![CDATA[Under the hood]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://skulljackpot.com/?p=29</guid>
		<description><![CDATA[<p>Making forms as usable and compact as possible is a fairly common goal in web design. Screen real estate is often at a premium, and finding ways to orient and provide information to users which doesn't require additional space can be a great asset.</p>
<p>I decided to write a jQuery plugin to help fill this need.</p>]]></description>
			<content:encoded><![CDATA[<p>Making forms as usable and compact as possible is a fairly common goal in web design. Screen real estate is often at a premium, and finding ways to orient and provide information to users which doesn&#8217;t require additional space can be a great asset.</p>
<p>One common solution is to use the approach written up at <a href="http://www.alistapart.com/articles/makingcompactformsmoreaccessible">A List Apart</a>, which involves using relative and absolute positioning to make labels appear on top of the associated text input. That approach can be brittle when it comes to more complex layouts, however.</p>
<p>Another common solution is to use inline javascript for onfocus and onblur attributes. This has the advantage of being robust in terms of layout, and is the technique currently in use on several of TOPP&#8217;s sites (including four instances on the <a href="http://www.livablestreets.com/projects">LivableStreets.com groups page</a>):</p>
<div class="thumbnail"><a href="http://skitch.com/dimmerswitch/hu8w/livable-streets-groups"><img src="http://img.skitch.com/20081124-ftdgys1pwhrusxwrnf3dcx2yhh.preview.jpg" alt="livable-streets-groups" /></a></div>
<p>This approach is not without drawbacks, though. Inline markup is never as elegant as listeners added via javascript, and  can pose maintainability problems. It&#8217;s easy for multiple instances of functionally-identical inline javascript within a site to diverge, as users make one-off tweaks to handle specific enhancement requests. Additionally, password fields are problematic, as Internet Explorer refuses to allow modification of the &#8220;type&#8221; attribute for input elements which have been added to the DOM.</p>
<p>I decided a while back to write a plugin to address these issues. My goals were to provide a tool which:</p>
<ul>
<li>Allowed informational text to be added to input elements</li>
<li>Was flexible enough to allow multiple ways to declare the text to be used, not just through referencing the relevant &lt;label&gt; element</li>
<li>Would be as robust as possible, in terms of avoiding layout problems</li>
<li>Would be easy for users to implement</li>
</ul>
<p>Things are finally far enough along that I feel comfortable sharing my latest jQuery plugin, <a href="http://github.com/chrispatterson/jquery-inline-info/tree/master">Inline Info</a>.</p>
<h2>Using the plugin</h2>
<p><strong>Note</strong>: this assumes that you&#8217;ve downloaded jQuery (<a href="http://docs.jquery.com/Downloading_jQuery">http://docs.jquery.com/Downloading_jQuery</a>) and the jQuery Inline Info plugin (<a href="http://github.com/chrispatterson/jquery-inline-info/tree/master">http://github.com/chrispatterson/jquery-inline-info/tree/master</a>). All examples can be used at the bottom of the page (immediately before the <code>&lt;/body&gt;</code> tag), or set to fire with <code>$(document).ready</code></p>
<p>When an element with inline info text loses focus, jquery-inline-info checks to see if the current value matches the info text, before resetting the value &amp; changing the class. This is not normally case-sensitive, but this behavior can be changes by passing in the <code>caseSensitiveMatch</code> parameter:</p>
<p><code>$('#ex-field').inlineInfoTextify({caseSensitiveMatch: "true"}); //default is "false"</code></p>
<p>By default, jquery-inline-info will use the <code>title</code> attribute of each input element as the info text. If no <code>title</code> is defined, it will instead use the value of the relevant <code>label</code> element. It&#8217;s also possible to specify the info text to use, by passing in the <code>inlineInfoText</code> parameter:</p>
<p><code>$('#ex-field').inlineInfoTextify({inlineInfoText: "Some very helpful text"});</code></p>
<p>jquery-inline-info also adds a class to input elements, when they are displaying info text. This class is also customizable, by passing in the <code>inlineInfoClass</code> parameter: </p>
<p><code>$('#ex-field').inlineInfoTextify({inlineInfoClass: "my-custom-class"});</code></p>
<p>You can also pass in multiple selectors in a single invocation:</p>
<p><code>$('#ex-field, #ex-field-2').inlineInfoTextify({inlineInfoClass: "my-custom-class"});</code></p>
<p>or selectors which match multiple elements:</p>
<p><code>$('#ex-form input[type="text"]').inlineInfoTextify({inlineInfoClass: "my-custom-class"});</code></p>
<p>The look and feel of the notice is totally customizable through CSS, and I&#8217;ve included a demo in the github repository to show various invocations in action.</p>
<p>Questions? Comments? Enhancement requests to make things more flexible? Put &#8216;em in the comments. I&#8217;m definitely interested in improving things, and about supporting stuff folks need.</p>
]]></content:encoded>
			<wfw:commentRss>http://skulljackpot.com/2008/11/24/inline-info/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Negative margins and Internet Explorer: a cautionary tale</title>
		<link>http://skulljackpot.com/2008/10/09/negative-margins-and-internet-explorer-a-cautionary-tale/</link>
		<comments>http://skulljackpot.com/2008/10/09/negative-margins-and-internet-explorer-a-cautionary-tale/#comments</comments>
		<pubDate>Thu, 09 Oct 2008 22:12:01 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
				<category><![CDATA[Under the hood]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[ie]]></category>
		<category><![CDATA[internet explorer]]></category>
		<category><![CDATA[negative margin]]></category>
		<category><![CDATA[renderbug]]></category>

		<guid isPermaLink="false">http://skulljackpot.com/?p=14</guid>
		<description><![CDATA[<p>When we were getting ready to launch the <a href="http://www.livablestreets.com/">LivableStreets</a> website earlier this year, I ran into an odd renderbug which I've finally had time to write up. The issue I found was that Internet Explorer would cut off portions of an element when negative margins caused it to extend beyond its parent.</p>]]></description>
			<content:encoded><![CDATA[<p>When we were getting ready to launch the <a href="http://www.livablestreets.com/">LivableStreets</a> website earlier this year, I ran into an odd renderbug which I&#8217;ve finally had time to write up. The issue I found was that Internet Explorer would cut off portions of an element when negative margins caused it to extend beyond its parent.</p>
<p>An example will probably help make the issue more clear.</p>
<p>The structure we&#8217;ll use is simple. A &#8220;container&#8221; div wth an explicit width will contain all our content. Each test case will be a &#8220;holder&#8221; div, which contains the paragraphs with negative margins to pull them beyond the boundaries of both parent elements.</p>
<p>In a standards-compliant rendering, elements can be caused to extend beyond containing elements, through the use of negative margins:</p>
<div class="thumbnail"><a href="http://skitch.com/dimmerswitch/2ym1/negative-margin-renderbug-ff3"><img src="http://img.skitch.com/20081009-knxryy3d6f9yfk46742uxxxt11.preview.jpg" alt="negative-margin-renderbug-ff3" /></a></div>
<p>Internet Explorer, of course, plays by different rules. Let&#8217;s start by looking at IE6:</p>
<div class="thumbnail"><a href="http://skitch.com/dimmerswitch/2ypf/microsoft-windows-xp"><img src="http://img.skitch.com/20081009-kq9w6wk27pkucpewy2fpgqj3tm.preview.jpg" alt="Microsoft Windows XP" /></a></div>
<p>When no width is set for the holder div, the paragraphs with negative margins are shown to extend beyond their holder div, but are clipped at the edge of the container div. However, when we explicitly set the width of the holder div to 100%, the paragraphs are clipped at the edge of the <em>holder</em> div &#8211; they&#8217;re not allowed to extend past <strong>any</strong> of the containing elements (more correctly, the <em>content</em> does extend past, but it&#8217;s inappropriately truncated, as though <code>overflow: hidden;</code> were declared on holder divs).</p>
<p>The same results are obtained in our second result set. When we declare the width in pixels, the paragraphs are clipped at the edge of the holder div. When we explicitly declare the width to be auto (same as the default property for block-level elements), content is clipped at the edge of the container div:</p>
<div class="thumbnail"><a href="http://skitch.com/dimmerswitch/2ypt/microsoft-windows-xp"><img src="http://img.skitch.com/20081009-mh75aa2fcbdrsgnkr146jdarpw.preview.jpg" alt="Microsoft Windows XP" /></a></div>
<p>With Internet Explorer 7, we get yet another curveball. IE7 does properly honor the negative left margin in all cases, regardless of whether (or how) we declare a width for the holder div. The <em>right</em> negative-margin isn&#8217;t so lucky. It still gets truncated exactly the same way as IE6:</p>
<div class="thumbnail"><a href="http://skitch.com/dimmerswitch/2ym6/microsoft-windows-xp"><img src="http://img.skitch.com/20081009-m6baux3bxd9mh8hub7tr4qt51x.preview.jpg" alt="Microsoft Windows XP" /></a></div>
<div class="thumbnail"><a href="http://skitch.com/dimmerswitch/2ycq/microsoft-windows-xp"><img src="http://img.skitch.com/20081009-mbeeufx1ij782b1r3f7p9nu76f.preview.jpg" alt="Microsoft Windows XP" /></a></div>
<p>It&#8217;s almost like the dev team created a unit test for left negative margins and decided they were all set.</p>
<p>To their credit, the IE8 team has fixed right negative margins, based on the current beta:</p>
<div class="thumbnail"><a href="http://skitch.com/dimmerswitch/2fpn/microsoft-windows-xp"><img src="http://img.skitch.com/20081009-brudmpxtmjx9bdmxp3mbbwwrhr.preview.jpg" alt="Microsoft Windows XP" /></a></div>
<p>So, if your site has sizable numbers of IE users (which, I think, is most of us), be aware that negative margins can cause unexpected consequences. Explicitly declaring <code>overflow: visible;</code> on holder and container has no impact on the resulting page renders. For the LSN launch, I ended up using relative positioning to achieve the desired affect.</p>
<p>Have a different workaround? I&#8217;d love to hear about it. In the meantime, <a href="http://skulljackpot.com/wp-content/uploads/2008/10/negativemarginrenderbug.html">here&#8217;s the testcase</a> I put together.</p>
]]></content:encoded>
			<wfw:commentRss>http://skulljackpot.com/2008/10/09/negative-margins-and-internet-explorer-a-cautionary-tale/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Click to Clipboard</title>
		<link>http://skulljackpot.com/2008/10/06/click-to-clipboard/</link>
		<comments>http://skulljackpot.com/2008/10/06/click-to-clipboard/#comments</comments>
		<pubDate>Mon, 06 Oct 2008 20:40:00 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
				<category><![CDATA[Under the hood]]></category>
		<category><![CDATA[clipboard]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://skulljackpot.com/?p=10</guid>
		<description><![CDATA[<p>Our team uses <a href="http://skitch.com/">Skitch</a> a lot. It's a pretty invaluable tool for communicating visual information - you can easily annotate screenshots or comps. There's great communicative value in being able to point at something, and as a remote employee in my past two jobs, I can't imagine ever collaborating on web work without it.</p>
<p>Skitch does a lot of things well, but one bit of polish which always pops out at new users is the "Click to Clipboard" functionality. Skitch provides lots of ways for you to share your images, and when you click in the appropriate field, the site copies all the data to your computer's clipboard, and presents a nice confirmation that you're ready to paste that elsewhere.</p>]]></description>
			<content:encoded><![CDATA[<p>Our team uses <a href="http://skitch.com/">Skitch</a> a lot. It&#8217;s a pretty invaluable tool for communicating visual information &#8211; you can easily annotate screenshots or comps. There&#8217;s great communicative value in being able to point at something, and as a remote employee in my past two jobs, I can&#8217;t imagine ever collaborating on web work without it.</p>
<p><strong>Aside</strong>: Skitch is Mac-only, but I&#8217;ve heard good things about <a href="http://www.jingproject.com/">Jing</a> if you&#8217;re on Windows. I don&#8217;t know of an equivalent solution on Linux, unfortunately.</p>
<p>Skitch does a lot of things well, but one bit of polish which always pops out at new users is the &#8220;Click to Clipboard&#8221; functionality. Skitch provides lots of ways for you to share your images, and when you click in the appropriate field, the site copies all the data to your computer&#8217;s clipboard, and presents a nice confirmation that you&#8217;re ready to paste that elsewhere:</p>
<div class="thumbnail"><a href="http://skitch.com/dimmerswitch/a7n7/skitch-clipboard-popup"><img src="http://img.skitch.com/20081006-1riux9tfy8ibu8nfwg84ceuqqs.preview.jpg" alt="skitch-clipboard-popup" title="Using Skitch to illustrate a feature on Skitch - so very, very meta." /></a></div>
<p>I decided to create a workalike function in <a href="http://jquery.com/">jQuery</a>, my favorite javascript library. I got a rudimentary version up and running a while back, building on the approach Jeff Larson wrote up, over at <a href="http://www.jeffothy.com/weblog/clipboard-copy/">http://www.jeffothy.com/weblog/clipboard-copy/</a>.</p>
<p>Today, I was able to get my workalike polished up and turned into my first jQuery plugin &#8211; it&#8217;s available at <a href="http://github.com/chrispatterson/jquery-clipboard/tree/master">http://github.com/chrispatterson/jquery-clipboard/tree/master</a>. There are still some pieces of polish I&#8217;m planning to add, but I&#8217;m pretty happy with it so far.</p>
<h3>Using the plugin</h3>
<p><strong>Note</strong>: this assumes that you&#8217;ve downloaded jQuery (<a href="http://docs.jquery.com/Downloading_jQuery">http://docs.jquery.com/Downloading_jQuery</a>), the jQuery Flash plugin (<a href="http://jquery.lukelutman.com/plugins/flash/">http://jquery.lukelutman.com/plugins/flash/</a>), and the jQuery Clipboard plugin (<a href="http://github.com/chrispatterson/jquery-clipboard/tree/master">http://github.com/chrispatterson/jquery-clipboard/tree/master</a>). All examples can be used at the bottom of the page (immediately before the &lt;/body&gt; tag), or set to fire with <code>$(document).ready</code></p>
<p>To add &#8220;click to clipboard&#8221; behavior to the element with an id of <code>share-link</code>:</p>
<p><code>$('#share-link').clickToClipboard();</code></p>
<p>To add &#8220;click to clipboard&#8221; behavior to all elements with a class of <code>shareable</code>:</p>
<p><code>$('.shareable').clickToClipboard();</code></p>
<p>clickToClipboard allows you to customize how long it takes for the notice to fade out, as well as the message used (for cases where you don&#8217;t want to use an image).</p>
<p>To have a slower fade effect, starting 1.5 seconds after the target element loses focus:</p>
<p><code>$('#share-link').clickToClipboard( {fadeoutLength: 900, fadeoutTimer: 1500}););</code></p>
<p>To customize the notice text:</p>
<p><code>$('#share-link').clickToClipboard( {clipboardText: "You're ready to paste!"}););</code></p>
<p>The look and feel of the notice is totally customizable through CSS. I&#8217;ve included a demo in <a href="http://github.com/chrispatterson/jquery-inline-info/tree/master">the github repository</a>, which shows how it might look with a background image. This is my first jQuery plugin, so I&#8217;m definitely open to feedback on ways to structure things better, or enhancement requests on how it be more flexible about supporting stuff folks need.</p>
]]></content:encoded>
			<wfw:commentRss>http://skulljackpot.com/2008/10/06/click-to-clipboard/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Better Blockquotes</title>
		<link>http://skulljackpot.com/2008/09/26/better-blockquotes/</link>
		<comments>http://skulljackpot.com/2008/09/26/better-blockquotes/#comments</comments>
		<pubDate>Fri, 26 Sep 2008 21:34:01 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
				<category><![CDATA[Under the hood]]></category>
		<category><![CDATA[blockquotes]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[improvement]]></category>
		<category><![CDATA[style]]></category>

		<guid isPermaLink="false">http://skulljackpot.com/?p=5</guid>
		<description><![CDATA[<p>For the <a href="http://streetsblog.org">Streetsblog</a> WordPress theme, we wanted to include a widget which would display a featured user comment. The comp had spiffy oversized quotes surrounding the featured text.</p>

<p>I'd seen <a href="http://24ways.org/2005/swooshy-curly-quotes-without-images">http://24ways.org/2005/swooshy-curly-quotes-without-images</a> a while back, and decided to improve upon it for the new Streetsblog site. In particular, the floated close quotes in Simon Willison's approach will often leave a lot of whitespace.</p>]]></description>
			<content:encoded><![CDATA[<p>For the <a href="http://streetsblog.org">Streetsblog</a> WordPress theme, we wanted to include a widget which would display a featured user comment. The comp had spiffy oversized quotes surrounding the featured text.</p>
<p>I&#8217;d seen <a href="http://24ways.org/2005/swooshy-curly-quotes-without-images">http://24ways.org/2005/swooshy-curly-quotes-without-images</a> a while back, and decided to improve upon it for the new Streetsblog site. In particular, the floated close quotes in Simon Willison&#8217;s approach will often leave a lot of whitespace.</p>
<div><a href="http://skitch.com/dimmerswitch/abbp/firefox-blockquotes-start"><img src="http://img.skitch.com/20081001-1yb7a73s1wtrkaa33dut89p8be.preview.jpg" alt="firefox-blockquotes-start"></a></div>
<p>The first version I&#8217;d done looked fine, and is what we launched with, but after a while folks found an odd renderbug. Internet Explorer (versions 6 and 7) would drop the quoted text down by about 2em, but <strong>only if the quote fit on a single line</strong>.</p>
<p>This week I was able to track down and fix the issue.</p>
<p>Here&#8217;s a screenshot of our launch CSS, as rendered by standards-compliant browsers:</p>
<div><a href="http://skitch.com/dimmerswitch/abbi/firefox-launch-css"><img src="http://img.skitch.com/20081001-tfjhrx5778361a788ftiikqhuu.preview.jpg" alt="firefox-launch-css"></a></div>
<p>Here&#8217;s a screenshot of our launch CSS, as rendered by Internet Explorer:</p>
<div><a href="http://skitch.com/dimmerswitch/abb5/ie7-blockquote-launch-css"><img src="http://img.skitch.com/20081001-kx2p6p6j3mt7d6tndh7c9c6iei.preview.jpg" alt="ie7-blockquote-launch-css"></a></div>
<p>After a little digging, it became clear that the issue was IE inappropriately using the line-height for the opening quote for the <em>entire</em> blockquote, in those cases where the blockquote fits on a single line.</p>
<p>Lots of tinkering with <code>line-height</code> and <code>vertical-align</code> properties ensued &#8211; those have got to be the least consistent CSS properties I&#8217;ve run into for a while, and will probably be the subject of a later post.</p>
<p>Eventually, I ended up with something that worked in standards-compliant browsers:</p>
<div><a href="http://skitch.com/dimmerswitch/abc5/firefox-better-blockquotes"><img src="http://img.skitch.com/20081001-crdh9pthbjbqpgdyyngfxtfcfe.preview.jpg" alt="firefox-better-blockquotes"></a></div>
<p>And looks fine in IE7:</p>
<div><a href="http://skitch.com/dimmerswitch/abnx/ie7-better-blockquotes"><img src="http://img.skitch.com/20081001-g7ajh8tmh1u2a85t2ehf89jy9f.preview.jpg" alt="ie7-better-blockquotes"></a></div>
<p>IE6 has an issue with line-height still &#8211; it will incorrectly indent the second line of text, to make room for the floated open quote (because IE6 ignores our explicit height declaration for that element):</p>
<div><a href="http://skitch.com/dimmerswitch/abna/ie6-betterblockquotes"><img src="http://img.skitch.com/20081001-f9reea1imk2hbg3n78equdyb8y.preview.jpg" alt="ie6-betterblockquotes"></a></div>
<p>That&#8217;s a tradeoff I&#8217;m willing to accept, in this case.</p>
<h2>Markup for Better Blockquotes</h2>
<p><code>&lt;blockquote class="selfclear"&gt;<br />
	&lt;span class="open-quote"&gt;<span>&#038;</span>#8220;&lt;/span&gt;<br />
	Fiction is obliged to stick to possibilities. Truth isn't.<br />
	&lt;span class="close-quote"&gt;<span>&#038;</span>#8221;&lt;/span&gt;<br />
&lt;/blockquote&gt;</code></p>
<p><strong>Note</strong>: The selfclear class is a variation of the clever method <a href="http://www.positioniseverything.net/easyclearing.html">originally written up</a> at Position Is Everything &#8211; used to clear floats without unnecessary markup.</p>
<h2>CSS for Better Blockquotes</h2>
<p><code>.selfclear:after {<br />
content: ".";<br />
display: block;<br />
height: 0;<br />
clear: both;<br />
visibility: hidden;<br />
}</code></p>
<p><code>.selfclear {<br />
display: inline-block; /* IE 7 */<br />
}</code></p>
<p><code>.selfclear {<br />
display: block;<br />
}</code></p>
<p><code>* html .selfclear {<br />
height: 1px; /* IE &lt; 7 */<br />
}</code></p>
<p><code>blockquote {<br />
font-style: italic;<br />
color: #191f2f;<br />
font-size: 1.3em;<br />
line-height: 2em;<br />
}</code></p>
<p><code>blockquote .open-quote, <br />
blockquote .close-quote {<br />
font-family: georgia, serif;<br />
color: #6b707e;<br />
font-style: normal;<br />
font-size: 4em;<br />
line-height: 1em;<br />
}</code></p>
<p><code>blockquote .open-quote {<br />
float: left;<br />
height: 0.35em;<br />
padding: 0 0.1em 0 0;<br />
vertical-align: -60%;<br />
position: relative;<br />
top: -0.1em;<br />
}</code></p>
<p><code>blockquote .close-quote {<br />
vertical-align: -50%;<br />
padding: 0 0 0 0.1em;<br />
}</code></p>
<p>Replace the fonts and colors as needed for your design, and you should be all set!</p>
]]></content:encoded>
			<wfw:commentRss>http://skulljackpot.com/2008/09/26/better-blockquotes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.271 seconds -->

