<?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>Software and Opinions &#187; gecko</title>
	<atom:link href="http://ianloic.com/tag/gecko/feed/" rel="self" type="application/rss+xml" />
	<link>http://ianloic.com</link>
	<description>from Ian McKellar</description>
	<lastBuildDate>Wed, 07 Sep 2011 21:48:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<atom:link rel='hub' href='http://ianloic.com/?pushpress=hub'/>
		<item>
		<title>Detecting advanced CSS features</title>
		<link>http://ianloic.com/2010/02/06/detecting-advanced-css-features/</link>
		<comments>http://ianloic.com/2010/02/06/detecting-advanced-css-features/#comments</comments>
		<pubDate>Sat, 06 Feb 2010 16:07:39 +0000</pubDate>
		<dc:creator>Ian McKellar</dc:creator>
				<category><![CDATA[Default]]></category>
		<category><![CDATA[chrome]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[gecko]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[opera]]></category>
		<category><![CDATA[safari]]></category>
		<category><![CDATA[transform]]></category>
		<category><![CDATA[webkit]]></category>

		<guid isPermaLink="false">http://ianloic.com/?p=207</guid>
		<description><![CDATA[I decided to do some fancy typography in my résumé, but I wanted to have a sane fallback for browsers that don&#8217;t support the latest features. I have my name rotated 90 degrees using CSS3 transforms, but simply applying the &#8230; <a href="http://ianloic.com/2010/02/06/detecting-advanced-css-features/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I decided to do some fancy typography in my <a href="http://ian.mckellar.org/resume/">résumé</a>, but I wanted to have a sane fallback for browsers that don&#8217;t support the latest features. I have my name rotated 90 degrees using <a href="http://www.w3.org/TR/css3-2d-transforms/">CSS3 transforms</a>, but simply applying the <code class="prettyprint">transform: rotate(-90deg)</code> CSS property isn&#8217;t enough to get the effect I want. To make it look right I also need to measure the text (since its dimensions will change depending on the viewer&#8217;s fonts) and absolutely position it based on that. Standard CSS fallback (where unrecognized rules are ignored) doesn&#8217;t give a good result. At all.</p>
<p>After a bunch of fiddling and cross-browser testing I found that testing the existence (<code class="prettyprint">!==undefined</code>) of properties on <code class="prettyprint">element.style</code> worked well. So I put all of my rotation rules in a CSS class that&#8217;s applied only if the style properties exist.</p>
<pre class="prettyprint">&lt;style type="text/css"&gt;
  h1.rotated {
    -webkit-transform-origin: left bottom;
    -moz-transform-origin: left bottom;
    -o-transform-origin: left bottom;
    transform-origin: left bottom;

    -webkit-transform: rotate(-90deg);
    -moz-transform: rotate(-90deg);
    -o-transform: rotate(-90deg);
    transform: rotate(-90deg);

    position: absolute;
    left: 0px;
    top: 0px;
    margin-top: 16px;
  }
&lt;/style&gt;
&lt;script type="text/javascript"&gt;
    // rotate the title, if that's even possible
    var h1 = document.getElementsByTagName('h1')[0];
    var s = document.body.style;

    // test for the presence of CSS3 transform properties
    if (s.transform !== undefined ||
        s.WebkitTransform !== undefined ||
        s.MozTransform !== undefined ||
        s.OTransform !== undefined) {
      // move
      h1.setAttribute('style',
          'top:' + ( h1.offsetWidth - h1.offsetHeight) + 'px');
      // and rotate
      h1.setAttribute('class', 'rotated');
    }
&lt;/script&gt;</pre>
<p>Of course, if I could just check for <code class="prettyprint">transform:</code> support rather than <code class="prettyprint">-webkit-transform:</code>, <code class="prettyprint">-moz-transform:</code> and <code class="prettyprint">-o-transform:</code> but we&#8217;re not there yet. Anyway, based on <a href="http://browsershots.org/">browsershots.org</a> it seems to do the right thing on every known browser. It shows rotated text in very recent Webkit and Gecko browsers, and in Opera nightlies, and unrotated, correctly text everywhere else.</p>
]]></content:encoded>
			<wfw:commentRss>http://ianloic.com/2010/02/06/detecting-advanced-css-features/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

