<?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>Thoughts From Eric &#187; Browsers</title>
	<atom:link href="http://meyerweb.com/eric/thoughts/category/tech/browsers/feed/" rel="self" type="application/rss+xml" />
	<link>http://meyerweb.com/eric/thoughts</link>
	<description>Things that Eric A. Meyer, CSS expert, writes about on his personal Web site; it&#039;s largely Web standards and Web technology, but also various bits of culture, politics, personal observations, and other miscellaneous stuff</description>
	<lastBuildDate>Thu, 09 Feb 2012 18:37:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Unfixed</title>
		<link>http://meyerweb.com/eric/thoughts/2012/02/09/unfixed/</link>
		<comments>http://meyerweb.com/eric/thoughts/2012/02/09/unfixed/#comments</comments>
		<pubDate>Thu, 09 Feb 2012 18:37:49 +0000</pubDate>
		<dc:creator>Eric Meyer</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Standards]]></category>
		<category><![CDATA[W3C]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/?p=1622</guid>
		<description><![CDATA[Vendor prefixes may soon be a thing of the past, and in the worst possible way.]]></description>
			<content:encoded><![CDATA[<p>Right in the middle of AEA Atlanta—which was <em>awesome</em>, I really must say—there were two announcements that stand to invalidate (or at least greatly alter) portions of the talk I delivered.  One, which I believe came out as I was on stage, was the publication of <a href="http://www.w3.org/TR/2012/WD-css3-positioning-20120207/">the latest draft of the CSS3 Positioned Layout Module</a>.  We’ll see if it triggers change or not; I haven’t read it yet.</p>

<p>The other was the publication of <a href="http://lists.w3.org/Archives/Public/www-style/2012Feb/0313.html">the minutes of the CSS Working Group meeting in Paris</a>, where it was revealed that several vendors are about to support the <code>-webkit-</code> vendor prefix in their own very non-WebKit browsers.  Thus, to pick but a single random example, Firefox would throw a drop shadow on a heading whose entire author CSS is <code>h1 {-webkit-box-shadow: 2px 5px 3px gray;}</code>.</p>

<p>As an author, it sounds good as long as you haven’t really thought about it very hard, or if perhaps you have a very weak sense of the history of web standards and browser development.  It fits right in with the recurring question, “Why are we screwing around with prefixes when vendors should just implement properties completely correctly, or not at all?”  Those idealized end-states always sound great, but years of evidence (and reams upon reams of bug-charting material) indicate it’s an unrealistic approach.</p>

<p>As a vendor, it may be the least bad choice available in an ever-competitive marketplace.  After all, if there were a few million sites that you could render as intended if only the authors used your prefix instead of just one, which would you rather: embark on a protracted, massive awareness campaign that would probably be contradicted to death by people with their own axes to grind; or just support the damn prefix and move on with life?</p>

<p>The practical upshot is that browsers “supporting alien CSS vendor prefixes”, <a href="http://www.netmagazine.com/news/css-vendor-prefixes-threaten-open-web-121757">as Craig Grannell put it</a>, seriously cripples the whole concept of vendor prefixes.  It may well reduce them to outright pointlessness.  I am <a href="http://alistapart.com/articles/prefix-or-posthack/">on record as being a fan of vendor prefixes</a>, and furthermore as someone who advocated for the formalization of prefixing as a part of the specification-approval process.  Of course I still think I had good ideas, but those ideas are currently being sliced to death on the shoals of reality.  Fingers can point all they like, but in the end what matters is what happened, not what should have happened if only we’d been a little smarter, a little more angelic, whatever.</p>

<p>I’ve seen a proposal that vendors agree to only support other prefixes in cases where they are un-prefixing their own support.  To continue the previous example, that would mean that when Firefox starts supporting the bare <code>box-shadow</code>, they will also support <code>-webkit-box-shadow</code> (and, one presumes, <code>-ms-box-shadow</code> and <code>-o-box-shadow</code> and so on).  That would mitigate the worst of the damage, and it’s probably worth trying.  It could well buy us a few years.</p>

<p>Developers are also trying to help repair the damage before it’s too late.  Christian Heilmann has <a href="http://christianheilmann.com/2012/02/09/now-vendor-prefixes-have-become-a-problem-want-to-help-fix-it/">launched an effort to get GitHub-based projects updated</a> to stop being WebKit-only, and Aarron Gustafson <a href="http://blog.easy-designs.net/archives/2012/02/09/this-must-not-happen/">has published a UNIX command to find all your CSS files containing <code>webkit</code></a> along with a call to update anything that’s not cross-browser friendly.  Others are making similar calls and recommendations.  You could use <a href="http://leaverou.github.com/prefixfree/">PrefixFree</a> as a quick stopgap while going through the effort of doing manual updates.  You could make sure your CSS pre-processor, if that’s how you swing, is set up to do auto-prefixing.</p>

<p>Non-WebKit vendors are in a corner, and we helped put them there.  If the proposed prefix change is going to be forestalled, we have to get them out.  Doing that will take a lot of time and effort and awareness and, above all, widespread interest in doing the right thing.</p>

<p>Thus my fairly deep pessimism.  I’d love to be proven wrong, but I have to assume the vendors will push ahead with this regardless.  It’s <a href="http://meyerweb.com/eric/thoughts/2008/01/24/almost-target/">what we did at Netscape ten years ago</a>, and almost certainly would have done despite any outcry.  I don’t mean to denigrate or undermine any of the efforts I mentioned before—they’re absolutely worth doing even if every non-WebKit browser starts supporting <code>-webkit-</code> properties next week.  If nothing else, it will serve as evidence of your commitment to professional craftsmanship.  The real question is: how many of your fellow developers come close to that level of commitment?</p>

<p>And I identify that as the real question because it’s the question vendors are asking—<em>must</em> ask—themselves, and the answer serves as the compass for their course.</p>]]></content:encoded>
			<wfw:commentRss>http://meyerweb.com/eric/thoughts/2012/02/09/unfixed/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Inconsistent Transitions</title>
		<link>http://meyerweb.com/eric/thoughts/2011/03/24/inconsistent-transitions/</link>
		<comments>http://meyerweb.com/eric/thoughts/2011/03/24/inconsistent-transitions/#comments</comments>
		<pubDate>Thu, 24 Mar 2011 20:24:14 +0000</pubDate>
		<dc:creator>Eric Meyer</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/?p=1499</guid>
		<description><![CDATA[An interesting little test case for transitions, and the inconsistencies it reveals.]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s <a href="http://meyerweb.com/eric/css/tests/css3-trans-an/transition-placement.html">an interesting little test case for transitions</a>.  Obviously you&#8217;ll need to visit it in a browser that supports CSS transitions, and additionally also CSS 2D transforms.  (I&#8217;m not aware of a browser that supports the latter without supporting the former, but your rendering may vary.)</p>

<p>In Webkit and Gecko, hovering the first <code>div</code> causes the <code>span</code> to animate a 270 degree rotation over one second, but when you unhover the <code>div</code> the <code>span</code> immediately snaps back to its starting position.  In Opera 11, the <code>span</code> is instantly transformed when you hover and instantly restored to its starting position when you unhover.</p>

<p>In all three (Webkit, Gecko, and Opera), hovering the second <code>div</code> triggers a one-second 270-degree rotation of the <code>span</code>.  Unhovering causes the rotation animation to be reversed; that is, a one-second minus-270-degree rotation—or, if you mouseout from the <code>div</code> before the animation finishes, an rotation from that angle back to the starting position.  Either way, it&#8217;s completely consistent across browsers.</p>

<p>The difference is that in the first test case, both the transform and the transition are declared on hover.  Like this (edited for clarity):</p>

<pre><code>div:hover span {
	transition: 1s transform;
	transform: rotate(270deg);
}</code></pre>

<p>In the second test case, the transform and the transition are split up like so:</p>

<pre><code>div span {
	transition: 1s transform;
}
div:hover span {
	transform: rotate(270deg);
}</code></pre>

<p>It&#8217;s an interesting set of results.  Only the second case is consistently animated across the tested browsers, but the first case only animates one direction in Webkit and Gecko.  I&#8217;m not sure which, if any, of these results is more correct than the other.  It could well be that they&#8217;re all correct, even if not consistent; or that they&#8217;re all wrong, just in different ways.</p>

<p>At any rate, the takeaway here is that you probably don&#8217;t want to apply your transition properties to the hover state of the thing you&#8217;re transitioning, but to the unhovered state instead.  I say &#8220;probably&#8221; because maybe you like that it transitions on mouseover and instantly resets on mouseout.  I don&#8217;t know that I&#8217;d rely on that behavior, though.  It feels like the kind of thing that programmer action, or even spec changes, will take away.</p>]]></content:encoded>
			<wfw:commentRss>http://meyerweb.com/eric/thoughts/2011/03/24/inconsistent-transitions/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Same As It Ever Was</title>
		<link>http://meyerweb.com/eric/thoughts/2011/03/07/same-as-it-ever-was/</link>
		<comments>http://meyerweb.com/eric/thoughts/2011/03/07/same-as-it-ever-was/#comments</comments>
		<pubDate>Mon, 07 Mar 2011 19:09:34 +0000</pubDate>
		<dc:creator>Eric Meyer</dc:creator>
				<category><![CDATA[(X)HTML]]></category>
		<category><![CDATA[Browsers]]></category>
		<category><![CDATA[History]]></category>
		<category><![CDATA[Writing]]></category>

		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/?p=1488</guid>
		<description><![CDATA[I recently became re-acquainted with a ghost, and it looked very, very familiar.]]></description>
			<content:encoded><![CDATA[<p>
I recently became re-acquainted with a ghost, and it looked very, very familiar.  In the spring of 1995, just over a year into my first Web gig and still just over a year away from first encountering CSS, I wrote the following:
</p>

<blockquote>
<h4>Writing to the Norm</h4>
<p>
No, not the fat guy on &#8220;Cheers.&#8221;  Actually, it&#8217;s a fundamental issue every Web author needs to know about and appreciate.
</p>
<p>
Web browsers are written by different people.  Each person has their own idea about how Web documents should look.  Therefore, any given Web document will be displayed differently by different browsers.  In fact, it will be displayed differently by different copies of the <i>same</i> browser, if the two copies have different preferences set.
</p>
<p>
Therefore, you need to keep this principle foremost in your mind at all times: <i>you cannot guarantee that your document will appear to other people exactly as it does to you.</i>  In other words, <b>don&#8217;t</b> fall into the trap of obsessively re-writing a document just to get it to &#8220;fit on one screen,&#8221; or so a line of text is exactly &#8220;one screen wide.&#8221;   This is as pointless as trying to take a picture that will always be one foot wide, no matter how big the projection screen. Changes in font, font size, window size, and so on will all invalidate your attempts.
</p>
<p>
On the other hand, you want to write documents which look acceptable to most people.  How?  Well, it&#8217;s almost an art form in itself, but my recommendation is that you assume that most people will set their browser to display text in a common font such as Times at a point size of somewhere between 10 and 15 points.  While you shouldn&#8217;t spend your time trying to precisely engineer page arrangement, you also shouldn&#8217;t waste time worrying about how pages will look for someone whose display is set to 27-point Garamond.
</p>
</blockquote>

<p>That&#8217;s from &#8220;Chapter 1: Terms and Concepts&#8221; of <cite>Introduction to HTML</cite>, my first publication of note and the first of three tutorials dedicated to teaching HTML in a friendly, interactive manner.  The tutorials were taken down a couple of years ago by their host organization, which made me a bit sad even though I understood why they didn&#8217;t want to maintain the pages (and deal with the support e-mail) any longer.</p>

<p>However, thanks to a colleague&#8217;s help and generosity I recently came into possession of copies of all three.  I&#8217;m still pondering what to do about it.  To put them back on the web would require a bit more work than just tossing them onto a server, and to make the quizzes fully functional would take yet more work, and after all this time some of the material is obsolete or even potentially misleading.  Not to mention the page is laid out using a table (woo 1995!).  On the other hand, they&#8217;d make an interesting historical document of sorts, a way to let you young whippersnappers know what it was like in the old days.</p>

<p>Reading through them, now sixteen years later, has been an interesting little trip down memory lane.  What strikes me most, besides the fact that my younger self was a better writer than my current self, is how remarkably stable the Web&#8217;s fluidity has been over its lifetime.  Yes, the absence of assuredly-repeatable layout is a core design principle, but it&#8217;s also the kind of thing that tends to get engineered away, particularly when designers and the public both get involved.  Its persistence hints that it&#8217;s something valuable and even necessary.  If I had to nominate one thing about the Web for the title of &#8220;Most Under-appreciated&#8221;, I think this would be it.</p>
]]></content:encoded>
			<wfw:commentRss>http://meyerweb.com/eric/thoughts/2011/03/07/same-as-it-ever-was/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Vendor Prefix Lists</title>
		<link>http://meyerweb.com/eric/thoughts/2010/10/08/vendor-prefix-lists/</link>
		<comments>http://meyerweb.com/eric/thoughts/2010/10/08/vendor-prefix-lists/#comments</comments>
		<pubDate>Fri, 08 Oct 2010 15:51:19 +0000</pubDate>
		<dc:creator>Eric Meyer</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Standards]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/?p=1386</guid>
		<description><![CDATA[At the prompting of an inquiry from a respected software vendor, I asked The Twitters for pointers to "canonical" lists of vendor-prefixed properties, values, and selectors.  Here's what the crowd sourced at me.]]></description>
			<content:encoded><![CDATA[<p>
At the prompting of an inquiry from a respected software vendor, <a href="https://twitter.com/meyerweb/status/26579041578">I asked The Twitters</a> for pointers to &#8220;canonical&#8221; lists of vendor-prefixed properties, values, and selectors.  Here&#8217;s what the crowd sourced at me:
</p>

<ul>
	<li><a href="http://msdn.microsoft.com/en-us/library/ms531207(VS.85).aspx">Microsoft</a><sup>†</sup></li>
	<li><a href="https://developer.mozilla.org/en/CSS_Reference/Mozilla_Extensions">Mozilla</a></li>
	<li><a href="http://www.opera.com/docs/specs/presto26/css/o-vendor/">Opera</a></li>
	<li><a href="http://developer.apple.com/library/safari/#documentation/AppleApplications/Reference/SafariCSSRef/Articles/StandardCSSProperties.html">Safari</a><sup>†</sup></li>
</ul>

<p class="note"><sup>†</sup>Lists more than just prefixed properties, values, and so on.</p>
<p>
While there&#8217;s no guarantee of completeness or accuracy, these are at least what the vendors themselves provide and so we can cling to some hope of both.  I was also pointed to the following third-party lists:
</p>

<ul>
<li><a href="http://peter.sh/experiments/vendor-prefixed-css-property-overview/">Vendor-prefixed CSS Property Overview &laquo;  Peter Beverloo</a></li>
<li><a href="http://qooxdoo.org/documentation/general/webkit_css_styles">qooxdoo &raquo; WebKit CSS Styles</a></li>
<li><a href="http://css-infos.net/properties/webkit.php">CSS Infos : Webkit CSS Properties</a></li>
<li><a href="http://css-infos.net/properties/firefox.php">CSS Infos : Firefox CSS Properties</a></li>
</ul>

<p>
If you know of great vendor-prefix lists that aren&#8217;t listed here, particularly anything from the vendors themselves, please let us know in the comments!
</p>

<p>
Somewhat if not obviously related: does anyone know of a way to add full Textile support to BBEdit 9.x?  Having it be a Unix filter is fine.  I know BBEdit already supports Markdown, but since Basecamp uses Textile and lots of people I work with use Basecamp, I&#8217;d like stick to one syntax rather than confuse myself trying to switch between two similar syntaxes.
</p>
]]></content:encoded>
			<wfw:commentRss>http://meyerweb.com/eric/thoughts/2010/10/08/vendor-prefix-lists/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>The Web Stack</title>
		<link>http://meyerweb.com/eric/thoughts/2010/05/19/the-web-stack/</link>
		<comments>http://meyerweb.com/eric/thoughts/2010/05/19/the-web-stack/#comments</comments>
		<pubDate>Wed, 19 May 2010 14:43:00 +0000</pubDate>
		<dc:creator>Eric Meyer</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[Standards]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/?p=1343</guid>
		<description><![CDATA[Following on <a href="http://meyerweb.com/eric/thoughts/2010/05/07/web-2-0-talk-html5-vs-flash/">my "HTML5 vs. Flash" talk</a> of a couple of weeks ago, I'm hoping to do a bit of blogging about HTML5, Flash, mobile apps, and more.  But first I need to get some terminology straight.]]></description>
			<content:encoded><![CDATA[<p>
Following on <a href="http://meyerweb.com/eric/thoughts/2010/05/07/web-2-0-talk-html5-vs-flash/">my &#8220;HTML5 vs. Flash&#8221; talk</a> of a couple of weeks ago, I&#8217;m hoping to do a bit of blogging about HTML5, Flash, mobile apps, and more.  But first I need to get some terminology straight.
</p>
<p>
As I did in my talk, I&#8217;m going to refer to the collection of front-end web-standards technologies—(X)HTML (of any flavor), CSS, and JavaScript—as &#8220;the web stack&#8221;.  I&#8217;ve seen the term used here and there and it makes the most sense to me as a condensed verbal shorthand.  It beats writing out the specific technologies every time or trying to use similarly clumsy constructions like &#8220;front-end tech&#8221;.  If you like, think of &#8220;web stack&#8221; as a rough equivalent to &#8220;Ajax&#8221;—a term that was invented because continually saying &#8220;asynchronous JavaScript + CSS + DOM + XMLHttpRequest&#8221; was unworkable.
</p>
<p>
The web stack sort of includes downloadable fonts, but only in the same sense that images or any other external resource is part of the stack.  SImilarly, it encompasses frameworks like jQuery in the sense that they&#8217;re built out of the components of the web stack.
</p>
<p>
When I use the term &#8220;web stack&#8221;, though, I&#8217;m not referring to back-end technologies.  Those things are important, certainly, but not from the front-end point of view.  A browser doesn&#8217;t care if your page was generated by PHP, Django, Rails, Perl, or what have you.  It doesn&#8217;t even care if the server runs on Apache or something else.
</p>
<p>
Furthermore, it doesn&#8217;t refer to plugins.  Yes, that means Flash, but it also means QuickTime, Real, ActiveX, and so forth.  What I need to make clear is that I&#8217;m not doing this in an attempt to imply that plugins don&#8217;t belong on the web at all.  They&#8217;re just not part of that core web stack any more than the web stack is part of them.  That doesn&#8217;t stop them working together, obviously.
</p>
<p>
Okay, so that&#8217;s out of the way, and I hope my meaning is sufficiently clear to everyone.  Please do leave a comment if it isn&#8217;t.  Onward!
</p>]]></content:encoded>
			<wfw:commentRss>http://meyerweb.com/eric/thoughts/2010/05/19/the-web-stack/feed/</wfw:commentRss>
		<slash:comments>44</slash:comments>
		</item>
		<item>
		<title>Turning Web Video On Its Head</title>
		<link>http://meyerweb.com/eric/thoughts/2010/04/07/turning-web-video-on-its-head/</link>
		<comments>http://meyerweb.com/eric/thoughts/2010/04/07/turning-web-video-on-its-head/#comments</comments>
		<pubDate>Wed, 07 Apr 2010 18:46:45 +0000</pubDate>
		<dc:creator>Eric Meyer</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[DOM]]></category>
		<category><![CDATA[Humor]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/?p=1314</guid>
		<description><![CDATA[Here's some fun.  (For a sufficiently nerdy definition of "fun".)]]></description>
			<content:encoded><![CDATA[<p>
Here&#8217;s some fun.  (For a sufficiently nerdy definition of &#8220;fun&#8221;.)
</p>

<ol>
	<li><p>Launch Safari 4 or Chrome 4.</p></li>
	<li><p>Drag <a href="javascript:(function(){var d=0;setInterval(function(){document.getElementsByTagName('video')[0].style['-webkit-transform']='rotate('+d+'deg)';d+=1},100)}());">Videotate</a> to the bookmarks bar.</p></li>
	<li><p>Go <a href="http://youtube.com/html5">opt into the YouTube HTML5 beta</a>.</p></li>
	<li><p>Find your favorite YouTube video.  Or maybe your least favorite.  Here&#8217;s one of my favorites: <a href="http://www.youtube.com/watch?v=9V5ubAOeOBk">Walk Don&#8217;t Run</a>.  Here&#8217;s <a href="http://www.youtube.com/watch?v=v82JqQAQqLE">another that&#8217;s not necessarily a favorite</a>, but it seems like a fairly appropriate choice.</p><p><strong>Note:</strong> not all videos are available via HTML5, even when you&#8217;re opted in.  If you get a Flash video, the bookmarklet won&#8217;t work.</p></li>
	<li><p>Once the video has started playing, activate the &#8220;Videotate&#8221; bookmarklet.</p></li>
	<li><p>Enjoy.</p></li>
</ol>

<p>
Thanks to <a href="http://simonwillison.net/" rel="acquaintance colleague met">Simon WIllison</a> for <a href="http://twitter.com/simonw/status/825123672">tweeting the JS</a> I modified, and <a href="http://adactio.com/" rel="friend colleague met">Jeremy Keith</a> for helping me realize it would be easy to do during the HTML5 portion of <a href="http://aneventapart.com/2010/seattle/#dayapart">A Day Apart</a>.
</p>
]]></content:encoded>
			<wfw:commentRss>http://meyerweb.com/eric/thoughts/2010/04/07/turning-web-video-on-its-head/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>Inspector Scrutiny</title>
		<link>http://meyerweb.com/eric/thoughts/2010/02/15/inspector-scrutiny/</link>
		<comments>http://meyerweb.com/eric/thoughts/2010/02/15/inspector-scrutiny/#comments</comments>
		<pubDate>Mon, 15 Feb 2010 14:54:23 +0000</pubDate>
		<dc:creator>Eric Meyer</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[Commentary]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/?p=1283</guid>
		<description><![CDATA[It's been said that web inspectors—Firebug, Dragonfly, and so forth—are not always entirely accurate.  The real truth is that web inspectors repeat to us the lies they are told, which are the same lies we can be told to our faces.]]></description>
			<content:encoded><![CDATA[<p>
It&#8217;s been <a href="http://meyerweb.com/eric/thoughts/2009/11/03/pseudo-phantoms/">said before</a> that web inspectors—Firebug, Dragonfly, the inspectors in Safari and Chrome, and so forth—are not always entirely accurate.  A less charitable characterization is that they lie to us, but that&#8217;s not exactly right.  The real truth is that web inspectors repeat to us the lies they are told, which are the same lies we can be told to our faces if we ask directly.
</p>
<p>
Here&#8217;s how I know this to be so:
</p>
<pre>
body {font-size: medium;}
</pre>
<p>
Just that.  Apply it to a <a href="http://meyerweb.com/eric/css/tests/medium-font.html">test page</a>.  Inspect the <code>body</code> element in any web inspector you care to fire up.  Have it tell you the computed styles for the <code>body</code> element.  Assuming you haven&#8217;t changed your browser&#8217;s font sizing preferences, the reported value will be <code>16px</code>.
</p>
<p>
You might say that that makes sense, since an unaltered browser equates <code>medium</code> with &#8220;16&#8243;.  But as we saw in &#8220;<a href="http://meyerweb.com/eric/thoughts/2010/02/12/fixed-monospace-sizing/">Fixed Monospace Sizing</a>&#8220;, the <code>16px</code> value is <em>not</em> what is inherited by child elements.  What is inherited is <code>medium</code>, but web inspectors <em>will never show you that</em> as a computed style.  You can see it in the list of declared styles, which so far as I can tell lists &#8220;specific values&#8221; (as per <a href="http://www.w3.org/TR/CSS2/cascade.html#value-stages">section 6.1 of CSS2.1</a>).  When you look to see what&#8217;s actually applied to the element in the &#8220;Computed Styles&#8221; view, you are being misled.
</p>
<p>
We can&#8217;t totally blame the inspectors, because what they list as computed styles is what they are given by the browser.  The inspectors take what the browser returns and prettify it for us, and give us ways to easily alter those values on the fly, but in the end they&#8217;re just DOM inspectors.  They don&#8217;t have a special line into the browser&#8217;s internal data.  Everything they report comes straight from the same DOM that any of us can query.  If you invoke:
</p>
<pre><code>var obj = document.getElementsByTagName('body')[0];
alert(getComputedStyle(obj,null).getPropertyValue('font-size'));</code>
</pre>
<p>
&#8230;on <a href="http://meyerweb.com/eric/css/tests/medium-font.html">a document being given the rule I mentioned above</a>, you will get back <code>16px</code>, not <code>medium</code>.
</p>
<p>
This fact of inspector life was also demonstrated in &#8220;<a href="http://meyerweb.com/eric/thoughts/2010/02/10/rounding-off/">Rounding Off</a>&#8220;.  As we saw there, browsers whose inspectors report integer pixel values also return them when queried directly from the DOM.  This despite the fact that <a href="http://meyerweb.com/eric/css/tests/font-size-rounding.html">it can be conclusively shown</a> that those same browsers are internally storing non-integer values.
</p>
<p>
Yes, it might be possible for an inspector to do its own analysis of properties like <code>font-size</code> by checking the element&#8217;s specified values (which it knows) and then crawling up the document tree to do the same to all of the element&#8217;s ancestors to try to figure out a more accurate computed style.  But what bothers me is that the browser reported computed values that simply aren&#8217;t accurate in the first place.  it seems to me that they&#8217;re really &#8220;actual values&#8221;, not &#8220;computed values&#8221;, again in the sense of <a href="http://www.w3.org/TR/CSS2/cascade.html#value-stages">CSS2.1:6.1</a>.  This makes <code>getComputedStyle()</code> fairly misleading as a method name; it should really be <code>getActualStyle()</code>.
</p>
<p>
No, I don&#8217;t expect the DOM or browsers to change this, which is why it&#8217;s all the more important for us to keep these facts in mind.  Web inspectors are very powerful, useful, and convenient DOM viewers and editors, essentially souped-up interfaces to what we could collect ourselves with JavaScript.  They are thus limited by what they can get the browser to report to them.  There are steps they might take to compensate for known limitations, but that requires them to second-guess both what the browser does now and what it might do in the future.
</p>
<p>
The point, if I may be so bold, is this:  never place all your trust in what a web inspector tells you.  There may be things it cannot tell you because it does not know them, and thus what it does tell you may on occasion mislead or confuse you.  Be wary of what you are told—because even though all of it is correct, not quite all of it is true, and those are always the lies that are easiest to believe.
</p>
]]></content:encoded>
			<wfw:commentRss>http://meyerweb.com/eric/thoughts/2010/02/15/inspector-scrutiny/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Fixed Monospace Sizing</title>
		<link>http://meyerweb.com/eric/thoughts/2010/02/12/fixed-monospace-sizing/</link>
		<comments>http://meyerweb.com/eric/thoughts/2010/02/12/fixed-monospace-sizing/#comments</comments>
		<pubDate>Fri, 12 Feb 2010 13:52:36 +0000</pubDate>
		<dc:creator>Eric Meyer</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Standards]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/?p=1265</guid>
		<description><![CDATA[Monospace text sizing is, from time to time, completely unintuitive and can be quite maddening if you don't look at it in exactly the right way.  Fortunately, there is a pretty simple workaround, and it's one you might want to consider using even if you weren't aware that a problem existed.]]></description>
			<content:encoded><![CDATA[<p>
Monospace text sizing is, from time to time, completely unintuitive and can be quite maddening if you don&#8217;t look at it in exactly the right way.  Fortunately, there is a pretty simple workaround, and it&#8217;s one you might want to consider using even if you weren&#8217;t aware that a problem existed.
</p>
<p>
But first, allow me to lay some foundations.  Assuming no other author styles beyond the ones shown, consider the following:
</p>
<pre>
span {font-family: monospace;}

&lt;p&gt;This is a 'p' with a &lt;span&gt;'span'&lt;/span&gt; inside.&lt;/p&gt;
</pre>

All right, what should be the computed <code>font-size</code> of the <code>span</code> element?  Remember, there are no other author styles being applied.

<p>
The savvier among you will have said: &#8220;It depends, but most likely <code>13px</code>.&#8221;  That&#8217;s because here, the size of the monospace text is controlled by the browser&#8217;s preferences.  The vast majority of users, of course, have never touched their default settings of &#8220;16&#8243; for proportional fonts and &#8220;13&#8243; for monospace/fixed fonts.  For them, then, the answer is <code>13px</code>.  Similarly, if I&#8217;d asked about the <code>p</code> element&#8217;s computed <code>font-size</code>, the answer would be: &#8220;It depends, but most likely <code>16px</code>.&#8221;
</p>
<p>
So let&#8217;s add a bit more and see where we land.
</p>
<pre>
span {font-family: monospace; font-size: 1em;}

&lt;p&gt;This is a 'p' with a &lt;span&gt;'span'&lt;/span&gt; inside.&lt;/p&gt;
</pre>
<p>
As before: bearing in mind that there are no other author styles, what should be the computed <code>font-size</code> of the <code>span</code> element?
</p>
<p>
In this case, building on the previous question and answer, you might say, &#8220;It depends, but most likely <code>16px</code>.&#8221;  The reasoning here is pretty straightforward:  since the computed <code>font-size</code> of the <code>p</code> element is <code>16px</code>, the <code>font-size: 1em;</code> assigned to the <code>span</code> will result in it having the same size.
</p>
<p>
And that&#8217;s true&#8230; in two of five browsers I <a href="http://meyerweb.com/eric/css/tests/monospaced3.html">tested</a>: Opera 10 and Internet Explorer 8.  In the other three I tested&mdash;Firefox 3.6, Safari 4, and Chrome 4&mdash;the computed (and rendered) <code>font-size</code> of the <code>span</code> is <code>13px</code>, the same as in our first example.  This result holds true if the rule is changed to use <code>font: 1em monospace;</code> instead of the two separate properties.  The behavior continues to persist even when adding specific font families, like Courier New, Courier, Andale Mono, and so on to the rule.  It also persists if <code>1em</code> is converted to <code>100%</code>.
</p>
<p>
So in other words, even though I have written CSS that explicitly says &#8220;Make the <code>font-size</code> of this element the same as its parent&#8221;, three of five browsers apparently ignore me.
</p>
<p>
I say &#8220;apparently&#8221; because what&#8217;s happening is that those browsers are allowing the <code>span</code> to inherit the default <code>font-size</code> from its parent (and thus, indirectly, all its ancestors), but the default <code>font-size</code> is <code>medium</code>.  If you go <a href="http://www.w3.org/TR/CSS2/fonts.html#font-size-props">look up <code>medium</code></a>, you find out that it doesn&#8217;t have a defined numeric size. So what those browsers do is equate <code>medium</code> with the preference settings, which means it&#8217;s different for monospace fonts than for everything else.
</p>
<p>
In other words, those three browsers are doing something like this:
</p>
<ol>
<li>This <code>span</code> needs to have the same <code>font-size</code> as its parent element.</li>
<li>The parent&#8217;s <code>font-size</code> is <code>medium</code>, even though when my web inspector (or an author&#8217;s DOM script) asks, I report the <code>16px</code> I used to output the text.  So the <code>span</code>&#8216;s <code>font-size</code> is actually <code>medium</code>.</li>
<li>This <code>medium</code>-sized <code>span</code> is using a monospace font.  The preference setting for monospace is &#8220;13&#8243;, and I equate <code>medium</code> with the preference setting, so I&#8217;ll output the <code>span</code> using 13-pixel text.</li>
</ol>
<p>
Opera 10, as I said, doesn&#8217;t do this, <em>even if your monospace font preference setting is the default value of &#8220;13&#8243;</em> or indeed different from the preference for non-monospace fonts.  And IE8 doesn&#8217;t appear to do it either, although you can&#8217;t set numeric font size preferences in IE8 so what it&#8217;s actually doing is open to interpretation.  Oh, IE8, you inscrutable little scamp, you.
</p>
<p>
All that might seem reasonable enough, but it turns out that&#8217;s not the whole story.  No, the three resizing browsers are being a good deal more &#8220;clever&#8221;, if that&#8217;s actually the word I want, than that.  In fact, what those browsers do makes it seem like they use the two preference settings to create a ratio, and that ratio is used to scale monospace text.  That&#8217;s not actually what&#8217;s happening, but it looks that way at first.  To see what I mean, let&#8217;s consider:
</p>
<pre>
span {font-family: monospace; font-size: 2em;}

&lt;p&gt;This is a 'p' with a &lt;span&gt;'span'&lt;/span&gt; inside.&lt;/p&gt;
</pre>
<p>
Again: in the absence of other author styles, what should be the computed <code>font-size</code> of the <code>span</code> element?
</p>
<p>
The answer: &#8220;It depends, but most likely <code>26px</code> as long as we aren&#8217;t talking about Opera 10 or IE8.  If it is one of those two, then most likely <code>32px</code>.&#8221;  Why?  Because the resizing browsers see the <code>font-size: 2em;</code> declaration as &#8220;twice <code>medium</code>&#8221; and twice 13 is 26.  Opera 10 and IE8, as previously established, don&#8217;t do the resizing.  Or else they simply interpret <code>medium</code> as being equal to the proportional font size preference setting.  Whatever.
</p>
<p>
Okay.  So what all this means is that in many browsers, you can declare that an element&#8217;s font size should be twice the size of its parent&#8217;s and have it actually be 1.625 times the size—or, if you want to look at it another way, 0.8125 times the size you expected it to be.  The 0.8125 comes from 26/32, which of course reduces to 13/16.  If you were to adjust your browser&#8217;s preferences so the monospace setting is &#8220;15&#8243;, then monospace fonts would be 0.9375 (15/16) times the expected size.
</p>
<p>
But—and here&#8217;s where things get <em>really</em> fun—this is not always so.  See, you may not have run into this problem if you&#8217;ve been declaring specific font families with no generic fallback.  Consider this variation (note that I dropped back to <code>1em</code> for the <code>font-size</code>):
</p>
<pre>
span {font-family: "Courier New"; font-size: 1em;}

&lt;p&gt;This is a 'p' with a &lt;span&gt;'span'&lt;/span&gt; inside.&lt;/p&gt;
</pre>
<p>
This time, in every one of the five browsers I mentioned before, assuming the browser defaults, the computed (and rendered) <code>font-size</code> of the <code>span</code> will be <code>16px</code>.  Not <code>13px</code>.  And the only difference is that we switched from a generic font family to a specific one.
</p>
<p>
&#8220;Hey presto!&#8221; you shout.  &#8220;We&#8217;ll just tack the generic family on the end there and be right as rain!&#8221;  Sadly, no.  For if you do this:
</p>
<pre>
span {font-family: "Courier New", monospace; font-size: 1em;}

&lt;p&gt;This is a 'p' with a &lt;span&gt;'span'&lt;/span&gt; inside.&lt;/p&gt;
</pre>
<p>
&#8230;then the answer to the question I keep asking will be:  &#8220;It depends, but given browser defaults it will be <code>16px</code>, unless we&#8217;re talking about Safari.  In that case, it&#8217;s <code>13px</code>.&#8221;
</p>
<p>
Really.  Alone among the browsers I tested, Safari goes back to doing the resizing when you provide a generic fallback to your specific family.  Or even multiple families.  Do your best to make sure the user at least gets a fixed-width font, and you get a size smaller than you&#8217;d intended.  (You can get the back story on this in <a href="http://webkit.org/blog/67/strange-medium/">a late-2006 post on the Surfin&#8217; Safari blog</a>.)
</p>
<p>
So what do we do?  Get creative.  That&#8217;s what the <a href="http://www.w3.org/WAI/PF/aria/"><acronym title="Accessible Rich Internet Applications">ARIA</acronym></a> folks did in <a href="http://www.w3.org/WAI/PF/aria/spec.css">their specification&#8217;s style sheet</a>, where they declare two font stacks: the first with a generic fallback, and the second without it.  That works, but it&#8217;s ugly.  I didn&#8217;t like that at all.  And then, halfway through writing up this post, a fix came to me like a shot in the dark.  Check this out:
</p>
<pre>
span {font-family: "Courier New", monospace, serif; font-size: 1em;}

&lt;p&gt;This is a 'p' with a &lt;span&gt;'span'&lt;/span&gt; inside.&lt;/p&gt;
</pre>
<p>
This time around, the answer is:  &#8220;It depends, but given browser defaults, <code>16px</code>.&#8221;
</p>
<p>
Really!  Even in Safari!  And in all tested browsers, it falls back to a generic monospace font at the requested size even if the specific family (or families) we declare aren&#8217;t available!  This can be verified by altering the specific font family to something that doesn&#8217;t actually exist:
</p>
<pre>
span {font-family: "Corier Neu", monospace, serif; font-size: 1em;}

&lt;p&gt;This is a 'p' with a &lt;span&gt;'span'&lt;/span&gt; inside.&lt;/p&gt;
</pre>
<p>
Monospacey goodness at the intended, parent-matching size.  It&#8217;s enough to make a body believe in monotheism.
</p>
<p>
Since I generally assume that anything I devise was already invented by someone else, I went Googling for prior art.  And wouldn&#8217;t you know it, the Wikipedia folks <a href="http://en.wikipedia.org/wiki/User:Davidgothberg/Test59">had worked it out around the end of last year</a>.  This, of course, supports my contention that <a href="http://www.youtube.com/watch?v=4sAIZlRMeEg">Wikipedia is the new Steve Allen</a>.  I also found some claims that ending the font stack with <code>monospace, monospace</code> would have the same effect, but that wasn&#8217;t borne out in <a href="http://meyerweb.com/eric/css/tests/monospaced3.html">my testing</a>.  Perhaps it worked in older versions of browsers but no longer does.
</p>
<p>
I did leave out another way to make monospaced fonts behave as expected, which you may have already figured out from the preceding: declare the <code>font-size</code> for any parent of a monospaced element to be a length value, along the lines of <code>body {font-size: 12px;}</code>.  That will pass the length value down the document tree to the monospaced element via inheritance, which will use it without resizing it in every browser I tested.  Though you may have heard that page zooming makes pixel-sized text okay, I&#8217;m not really convinced.  Not yet.  There are too many people who don&#8217;t know how to zoom, and too many whose browsers aren&#8217;t advanced enough to zoom pages.  Even in page-zooming browsers, there are problems with pixel text.  So I&#8217;m still on the ems-and-percentages bandwagon.
</p>
<p>
In fact, there are a fair number of details and extra browser oddities that I left out of this, as it&#8217;s already way more than long enough, and besides you don&#8217;t really want to hear the gory details of manually stepping through 37 different preferences settings just to verify a theory.  Plus you already heard about <a href="http://meyerweb.com/eric/thoughts/2010/02/10/rounding-off/">the <code>font-size</code> rounding investigation</a> that spawned off of this one, about halfway through.  I think that&#8217;s more than enough for the time being.
</p>
<p>
I should also lay down a caveat: it&#8217;s possible that this behavior will be interpreted as a bug by the Safari team and &#8220;fixed&#8221;, if that&#8217;s the word I want, in a future release.  I really hope not—and if they&#8217;re looking for ways to improve how they handle monospace font sizing, I have a few suggestions—but it is possible.  Adjust your expectations accordingly.
</p>
<p>
And with that, I&#8217;m going to stop now.  I hope this will be useful to you, either now or in the future.
</p>
]]></content:encoded>
			<wfw:commentRss>http://meyerweb.com/eric/thoughts/2010/02/12/fixed-monospace-sizing/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>Rounding Off</title>
		<link>http://meyerweb.com/eric/thoughts/2010/02/10/rounding-off/</link>
		<comments>http://meyerweb.com/eric/thoughts/2010/02/10/rounding-off/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 18:42:44 +0000</pubDate>
		<dc:creator>Eric Meyer</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/?p=1253</guid>
		<description><![CDATA[In the course of digging into the guts of a much more complicated problem, I stumbled into an interesting philosophical question posed by web inspection tools.]]></description>
			<content:encoded><![CDATA[<p>
In the course of digging into the guts of a much more complicated problem, I stumbled into an interesting philosophical question posed by web inspection tools.
</p>
<p>
Consider the following CSS and HTML:
</p>
<pre>
p {font-size: 10px;}
b {font-size: 1.04em;}

&lt;p&gt;This is text &lt;b&gt;with some boldfacing&lt;/b&gt;.&lt;/p&gt;
</pre>
<p>
Simple enough.  Now, what is the computed <code>font-size</code> for the <code>b</code> element?
</p>
<p>
There are two valid answers.  Most likely one of them is intuitively obvious to you, but take a moment to contemplate the rationale for the answer you didn&#8217;t pick.
</p>
<p>
Now, consider the ramifications of both choices on a situation where there are <code>b</code> elements nested ten layers deep.
</p>
<p>
If you hold that the answer is <code>10px</code>, then the computed <code>font-size</code> of the tenth level of nesting should still be <code>10px</code>, because at every level of nesting the mathematical answer will be rounded down to 10.  That is: for every <code>b</code> element, its computed <code>font-size</code> will be <code>round(10*1.04)</code>, which will always yield 10.
</p>
<p>
If, on the other hand, you hold that the answer is <code>10.4px</code>, then the computed <code>font-size</code> of the tenth level of nesting should be <code>14.802442849px</code>.  That might get rounded to some smaller number of decimal places, but even so, the number should be pretty close to 14.8.
</p>
<p>
The simplest test, of course, is to <a href="http://meyerweb.com/eric/css/tests/font-size-rounding.html">set up a ten-level-deep nesting of <code>b</code> elements with the previously-shown CSS and find out what happens</a>.  If the whole line of text is the same size, then browsers round their computed <code>font-size</code> values before passing them on.  If the text swells in size as the nesting gets deeper, then they don&#8217;t.
</p>
<p>
As it happens, in all the browsers I&#8217;ve tested, the text swells, so browsers are passing along fractional pixel values from level to level.  That&#8217;s not the interesting philosophical question.  Instead, it is this:  <em>do web inspectors that show integer <code>font-size</code> values in their &#8216;computed style&#8217; windows lie to us?</em>
</p>
<p>
To see what I mean, load up <a href="http://meyerweb.com/eric/css/tests/font-size-rounding.html">the font size rounding test page</a> in Firefox and use Firebug to inspect the &#8220;1(&#8220;, which is the first of the <code>b</code> elements, in the first (1.04em) test case.  Make sure you&#8217;re looking at the &#8220;Computed Styles&#8221; pane in Firebug, and you&#8217;ll get a computed <code>font-size</code> of <code>10.4px</code>.  That makes sense: it&#8217;s 10 × 1.04.
</p>
<p>
Now try the inspecting that same &#8220;1(&#8221; in Safari or Opera.  Both browsers will tell you that the computed <code>font-size</code> of that <code>b</code> element is <code>10px</code>.  But we already know that it&#8217;s actually <code>10.4px</code>, because the more deeply-nested layers of <code>b</code> elements increase in size.  These inspectors are rounding off the internal number before showing it to us.  Arguably, they are lying to us.
</p>
<p>
But are they really?  The reason to doubt this conclusion is that the values shown in those inspectors accurately reflect the value being used to render the characters on-screen.  To see what I mean, look at the last example on the test page, where there&#8217;s sub-pixel size testing.  The &#8220;O&#8221; characters run from a flat 10 pixels to a flat 11 pixels in tenths (or less) of a pixel, all of their <code>font-size</code>s assigned with inline <code>style</code> elements to pin the characters down as much as possible.  In Safari, you can see the size jump up one pixel right around the text&#8217;s midpoint, where I wrote <code>font-size: 10.5px</code>.  So everything from <code>10px</code> to <code>10.49px</code> gets drawn at 10 pixels tall; everything from <code>10.5px</code> to <code>11px</code> is 11 pixels tall.  Safari&#8217;s inspector reflects this accurately.  It&#8217;s telling you the size used to draw the text.
</p>
<img src="http://meyerweb.com/pix/2010/OOOOO.png" alt="A comparative illustration of the many-O test case in three different browsers showing three different results.  The browsers used to create the illustration were Safari, Opera, and Firefox." class="pic border" />
<p>
In Opera 10.10, you get the same thing except that the jump from 10 to 11 pixels happens on the very last &#8220;O&#8221;, both visually and in the inspector (Dragonfly).  That means that when it comes to font sizes, Opera <em>always rounds down</em>.  Everything from <code>10px</code> to <code>10.9px</code>—and, presumably, <code>10.99999px</code> for as many nines as you&#8217;d care to add—will be drawn 10 pixels tall.  Brilliant.
</p>
<p>
In Firefox for OS X, there&#8217;s no size jump.  The &#8220;O&#8221; characters look like they form a smooth line of same-size text.  In fact, they&#8217;re all being drawn subtly differently, thanks to their subtly different <code>font-size</code> values.  If you use OS X&#8217;s Universal Access screen zooming to zoom way, way in, you can see the differences in pixel shading from one &#8220;O&#8221; to the next.  Even if you don&#8217;t, though, the fact that it&#8217;s hard to tell that there is an increase in size from one end of the line to the other is evidence enough.
</p>
<p>
In Firefox for XP, on the other hand, the size jump occurs just as it does in Safari, going from 10 pixels to 11 pixels of text size at the 10.5 mark.  But Firebug still reports the correct computed <code>font-size</code> values.  Thus, its reported value doesn&#8217;t match the size of the text that&#8217;s been output to the screen.  Arguably, it&#8217;s lying just as much as Safari and Opera,  in a different way.
</p>
<p>
But, again: is it really?  The computed values are being accurately reported.  That there is a small variance between that fractional number and the display of the text is arguably irrelevant, and can lead to its own confusion.  Situations will arise where apparent rounding errors have occurred—I see people complain about them from time to time—when the apparent error is really an artifact of how information is delivered.
</p>
<p>
I have my own thoughts about all this, but I&#8217;m much more interested in the thoughts of others.  <strong>What do you think?</strong>  Should web inspectors report the CSS computed values accurately, without regard to the actual rendering effects; or should the inspectors modify the reported values to more accurately reflect the visual rendering, thus obscuring the raw computed values?
</p>

<p>
<strong>Addendum 10 Feb 10:</strong> I&#8217;ve updated the test page with a JS link that will dynamically insert the results of <code>getComputedStyle(el,null).getPropertyValue("font-size")</code> into the test cases.  The results are completely consistent with what the inspectors report in each browser.  This tells us something about the inspectors that most of us probably don&#8217;t consciously realize: that what they show us rests directly on the same JS/DOM calls we could write ourselves.  In other words, inspectors are not privileged in what they can &#8220;see&#8221;; they have no special view into the browser&#8217;s guts.  Thus another way to look at this topic is that inspectors simply repeat the lies that browsers tell the world.
</p>]]></content:encoded>
			<wfw:commentRss>http://meyerweb.com/eric/thoughts/2010/02/10/rounding-off/feed/</wfw:commentRss>
		<slash:comments>36</slash:comments>
		</item>
		<item>
		<title>MIX Judging</title>
		<link>http://meyerweb.com/eric/thoughts/2010/01/22/mix-judging/</link>
		<comments>http://meyerweb.com/eric/thoughts/2010/01/22/mix-judging/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 20:50:25 +0000</pubDate>
		<dc:creator>Eric Meyer</dc:creator>
				<category><![CDATA[(X)HTML]]></category>
		<category><![CDATA[Browsers]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[Standards]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/?p=1242</guid>
		<description><![CDATA[MIX is having a 10K contest, HTML 5 is one of the allowed formats, and I'm a contest judge.]]></description>
			<content:encoded><![CDATA[<p>
I was recently honored to be asked to be a judge for the <a href="http://mix10k.visitmix.com/">MIX 10k Smart Coding Challenge</a>, running in conjunction with Microsoft&#8217;s <a href="http://visitmix.com/">MIX conference</a>.  The idea is to create a really great web application that totals no more than 10KB in its unzipped state.
</p>
<p>
Why did I agree to participate?  As much as I&#8217;d like to say &#8220;<a href="http://www.penny-arcade.com/comic/2000/10/23/">fat sacks of cash</a>&#8220;, that wasn&#8217;t it at all.  (Mostly due to the distinct lack of cash, sacked or otherwise.  Sad face.)  The <a href="http://mix10k.visitmix.com/Terms#4">contest&#8217;s entry requirements</a> actually say it for me.  In excerpted form:
</p>

<ul>
<li>The entry MUST use one or more of the following technologies: Silverlight, Gestalt or HTML5&#8230;</li>
<li>The entry MUST function in 3 or more of the following browsers: Internet Explorer, Firefox, Safari, Opera, or Chrome&#8230;</li>
<li>The entry MAY use any of the following additional technology components&#8230;
<ul>
<li>CSS</li>
<li>JavaScript</li>
<li>XAML/XML</li>
<li>Ruby</li>
<li>Python</li>
<li>Text, Zip and Image files (e.g. png, jpg or gif)</li>
</ul>
</li>
</ul>

<p>
Dig that:  not only is the contest open to HTML 5 submissions, but it has to be cross-browser compatible.  Okay, technically it only has to be three-out-of-five compatible, but still, that&#8217;s a great contest requirement.  Also note that while IE is one of the five, it is not a <em>required</em> one of the five.
</p>
<p>
I imagine there will be a fair number of Silverlight and Gestalt entries, and I might look at them, but I&#8217;m really there—was really asked—because of the HTML 5 entries.  By which I mean the open web entries, since any HTML 5 entry is also going to use CSS, JavaScript, and so on.
</p>
<p>
The downside here is that the contest ends in just one week, at 3pm U.S. Pacific time on 29 January.  I know that time is tight, but if you&#8217;ve got a cool HTML 5-based application running around in your head, this just might be the time to let it out.
</p>
]]></content:encoded>
			<wfw:commentRss>http://meyerweb.com/eric/thoughts/2010/01/22/mix-judging/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Pseudo-Phantoms</title>
		<link>http://meyerweb.com/eric/thoughts/2009/11/03/pseudo-phantoms/</link>
		<comments>http://meyerweb.com/eric/thoughts/2009/11/03/pseudo-phantoms/#comments</comments>
		<pubDate>Tue, 03 Nov 2009 17:41:10 +0000</pubDate>
		<dc:creator>Eric Meyer</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[DOM]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/?p=1180</guid>
		<description><![CDATA[In the course of a recent debugging session, I discovered a limitation of web inspectors (Firebug, Dragonfly, Safari&#8217;s Web Inspector, et al.) that I hadn&#8217;t quite grasped before: they don&#8217;t show pseudo-elements and they&#8217;re not so great with pseudo-classes. There&#8217;s one semi-exception to this rule, which is Internet Explorer 8&#8242;s built-in Developer Tool. It shows [...]]]></description>
			<content:encoded><![CDATA[<p>
In the course of a recent debugging session, I discovered a limitation of web inspectors (Firebug, Dragonfly, Safari&#8217;s Web Inspector, et al.) that I hadn&#8217;t quite grasped before: they don&#8217;t show pseudo-elements and they&#8217;re not so great with pseudo-classes.  There&#8217;s one semi-exception to this rule, which is Internet Explorer 8&#8242;s built-in Developer Tool.  It shows pseudo-elements just fine.
</p>
<p>
Here&#8217;s an example of what I&#8217;m talking about:
</p>

<pre><code>p::after {content: " -\2761-"; font-size: smaller;}
</code></pre>

<p>
Drop that style into any document that has paragraphs.  Load it up in your favorite development browser.  Now inspect a paragraph.  You will not see the generated content in the DOM view, and you won&#8217;t see the pseudo-element rule in the Styles tab (except in IE, where you get the latter, though not the former).
</p>

<a href="http://www.flickr.com/photos/meyerweb/4071955467/"><img src="http://meyerweb.com/pix/2009/firebug-crop.png" class="pic border" alt="" /></a>

<p>
The problem isn&#8217;t that I used an escaped Unicode reference; take that out and you&#8217;ll still see the same results, as on <a href="http://meyerweb.com/eric/css/tests/pseudos-inspector-test.html">the test page I threw together</a>.  It isn&#8217;t the double-colon syntax, either, which all modern browsers handle just fine; and anyway, I can take it back to a single colon and still see the same results.  <code>::first-letter</code>, <code>::first-line</code>, <code>::before</code>, and <code>::after</code> are all basically invisible in most inspectors.
</p>
<p>
This can be a problem when developing, especially in cases such as having a forgotten, runaway <a href="http://www.positioniseverything.net/easyclearing.html">generated-content clearfix</a> making hash of the layout.  No matter how many times you inspect the elements that are behaving strangely, you aren&#8217;t going to see anything in the inspector that tells you why the weirdness is happening.
</p>
<p>
The same is largely true for dynamic pseudo-classes.  If you style all five link states, only two will show up in most inspectors&#8212;either <code>:link</code> or <code>:visited</code>, depending on whether you&#8217;ve visited the link&#8217;s target; and <code>:focus</code>.  (You can sometimes also get <code>:hover</code> in Dragonfly, though I&#8217;ve not been able to do so reliably.  IE8&#8242;s Developer Tool always shows <code>a:link</code> even when the link is visited, and doesn&#8217;t appear to show any other link states.  &#8230;yes, this is getting complicated.)
</p>
<p>
The more static pseudo-classes, like <code>:first-child</code>, do show up pretty well across the board (except in IE, which doesn&#8217;t support all the advanced static pseudo-classes; e.g., <code>:last-child</code>).
</p>

<a href="http://www.flickr.com/photos/meyerweb/4072718108/"><img src="http://meyerweb.com/pix/2009/iedevtool-crop.png" class="pic border" alt="" /></a>

<p>
I can appreciate that inspectors face an interesting challenge here.  Pseudo-elements are just that, and aren&#8217;t part of the actual structure.  And yet Internet Explorer&#8217;s Developer Tool manages to find those rules and display them without any fuss, even if it doesn&#8217;t show generated content in its DOM view.  Some inspectors do better than others with dynamic pseudo-classes, but the fact remains that you basically can&#8217;t see some of them even though they will potentially apply to the inspected link at some point.
</p>
<p>
I&#8217;d be very interested to know what inspector teams encountered in trying to solve this problem, or if they&#8217;ve never tried.  I&#8217;d be <em>especially</em> interested to know why IE shows pseudo-elements when the others don&#8217;t&#8212;is it made simple by their rendering engine&#8217;s internals, or did someone on the Developer Tool team go to the extra effort of special-casing those rules?
</p>
<p>
For me, however, the overriding question is this: what will it take for the various inspectors to behave more like IE&#8217;s does, and show pseudo-element and pseudo-class rules that are associated with the element currently being inspected?  And as a bonus, to get them to show in the DOM view where the pseudo-elements actually live, so to speak?
</p>
<p>
<small>(<strong>Addendum:</strong> when I talk about IE and the Developer Tool in this post, I mean the tool built into IE8.  I did not test the Developer Toolbar that was available for IE6 and IE7.  Thanks to <a href="http://www.bogglethemind.com/">Jeff L</a> for pointing out the need to be clear about that.)</small>
</p>]]></content:encoded>
			<wfw:commentRss>http://meyerweb.com/eric/thoughts/2009/11/03/pseudo-phantoms/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Handling an Explicit-Width Bug in Internet Explorer</title>
		<link>http://meyerweb.com/eric/thoughts/2009/04/11/handling-an-explicit-width-bug-in-internet-explorer/</link>
		<comments>http://meyerweb.com/eric/thoughts/2009/04/11/handling-an-explicit-width-bug-in-internet-explorer/#comments</comments>
		<pubDate>Sat, 11 Apr 2009 20:53:54 +0000</pubDate>
		<dc:creator>Eric Meyer</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://meyerweb.com/?p=1112</guid>
		<description><![CDATA[I stumbled into a width-increasing bug in IE6 and IE7, and was helped in finding a workaround.]]></description>
			<content:encoded><![CDATA[<p>
In creating the combo-bar charts for <a href="http://aneventapart.com/alasurvey2008">the survey report</a>, I stumbled into an Explorer bug that I didn&#8217;t remember ever seeing before, and Google didn&#8217;t turn up anything that seemed to be related.  This could easily mean that I&#8217;m the only person who ever did something this insane and thus found the bug.  It could just as easily mean that my Google-fu has failed.  Either way, I&#8217;ll write it up here so it can enter the collective memory.  (And surely someone has already noted that Google is positively Jungian?)
</p>
<p>
You can see both the problem and two workarounds if you visit <a href="http://meyerweb.com/eric/css/tests/winie/table-double/testcase.html">this test page</a> using IE6 or IE7.  In brief, the problem occurred when I had a table cell containing a paragraph with an explicit width set.  I did this through the <code>style</code> attribute, though tests show that for this bug, it doesn&#8217;t matter whether you use the attribute or assign it via a style sheet.  Around these explicit-width paragraphs were <code>div</code> elements with <code>width: 200%;</code>, for bar-drawing purposes (it&#8217;s a little complicated).  Everything was fine in 99% of cases.  But as soon as the header text at the beginning of the row went to two lines of text, the explicit-width paragraphs doubled in width.  What was <code>80.1%</code> wide would be drawn as though it were <code>160.2%</code> wide.
</p>
<p>
My hopefully understandable reaction was to say, &#8220;Whuh?&#8221;.  I threw a few hasLayout triggers at the offending paragraph (relative position, <code>zoom</code>, etc.) and got nowhere.  In the end I worked around the problem by telling IE6 and IE7 to not wrap text in the row headers of combo charts.  (The bug is not present in IE8.)
</p>
<p>
I mentioned all this in <a href="http://meyerweb.com/eric/thoughts/2009/04/07/findings-of-the-a-list-apart-survey-2008/">my announcement post</a>, and the ever-awesome <a href="http://wilkinsonweb.com/">Dan Wilkinson</a> <a href="http://meyerweb.com/eric/thoughts/2009/04/07/findings-of-the-a-list-apart-survey-2008/#comment-454002">discovered</a> that the problem could be fixed by setting all of the table rows to, say, <code>height: 3em</code>.  Armed with that breakthrough, I experimented a little more and found that I could actually set the offending table row&#8217;s height to <code>2.75em</code> and still have things work as intended.  Below that and the paragraph widths doubled.
</p>
<p>
Then I lowered the <code>line-height</code> of the headers to <code>1</code> and found that I could take the overall row&#8217;s <code>height</code> as low as <code>2.33em</code> before triggering the bug.  And that&#8217;s when it dawned: the bug was triggered by the layout height of the header cell&#8217;s content being taller than the content of the cell containing the paragraph, <em>and</em> not explicitly declaring styles that would make the data cell as tall as or taller than the height needed to have the header cell contain its content.
</p>
<p>
Okay, that&#8217;s a little dense.  Let me step through the symptoms and two found workarounds to see if that clears it up:
</p>

<ol>
<li>The data cell always has a single line of text.  The bug is triggered by having the header cell go to two lines of text, whereas it is not if the header cell has a single line of text.</li>
<li>If the row&#8217;s height is explicitly set to a value equal to or greater than the header cell&#8217;s content, the bug is not triggered.</li>
<li>Alternatively, if the height of the data cell is set or forced to be equal to or greater than the height of the header cell, the bug is not triggered.  This can be done with an explicit <code>height</code> or with added top and bottom padding or by adding top and bottom margins to the paragraphs in the cell.</li>
</ol>

<p>
Some side tests I did indicate that the header cell is <em>not</em> needed to trigger the bug.  In other words, the problem could happen even if there are only data cells in the row.  Furthermore, I found that the width-scaling was directly affected by the <code>width</code> of the wrapping <code>div</code>, and thus the widths were doubling only because I had the <code>div</code>&#8216;s <code>width</code> set to <code>200%</code>.  If I set it to <code>150%</code> instead of <code>200%</code>, then the paragraphs only got half again as wide instead of doubling.  That seems to make sense until you see it in action.  When I say the paragraphs got half again as wide, I mean that instead of being 75% as wide as the <code>div</code>, they were 112.5% as wide as the <code>div</code>.  If I set the <code>div</code>&#8216;s <code>width</code> to <code>200%</code>, then they were 150% the width of the <code>div</code>.
</p>
<p>
So.  As I say, this bug does not affect IE8, so that&#8217;s good, and it can be worked around in IE6 and IE7, which is even better.  The problem would be if you didn&#8217;t know how tall your cells might get&#8212;in my case, I can be (reasonably) sure that the tallest a cell&#8217;s content will ever get is two lines of text, and by setting an explicit <code>line-height</code> on the headers I can know how tall I have to make the rows in order to avoid the bug.
</p>
<p>
Another day, another workaround!
</p>
]]></content:encoded>
			<wfw:commentRss>http://meyerweb.com/eric/thoughts/2009/04/11/handling-an-explicit-width-bug-in-internet-explorer/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Wanted: Layout System</title>
		<link>http://meyerweb.com/eric/thoughts/2009/02/17/wanted-layout-system/</link>
		<comments>http://meyerweb.com/eric/thoughts/2009/02/17/wanted-layout-system/#comments</comments>
		<pubDate>Tue, 17 Feb 2009 15:00:14 +0000</pubDate>
		<dc:creator>Eric Meyer</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Rants]]></category>
		<category><![CDATA[Standards]]></category>
		<category><![CDATA[W3C]]></category>

		<guid isPermaLink="false">http://meyerweb.com/?p=1052</guid>
		<description><![CDATA[Not surprisingly, there was a lot of community feedback <a href="http://fantasai.inkedblade.net/style/discuss/wasp-feedback-2008#layout">asking for better layout mechanisms</a>.  Actually, people were asking for any decent layout mechanism at all, which CSS has historically lacked.  It needs one.]]></description>
			<content:encoded><![CDATA[<p class="aside">(This is part of the <a href="http://meyerweb.com/eric/thoughts/2009/02/11/feedback-on-wasp-community-css3-feedback-2008/">Feedback on &#8216;WaSP Community CSS3 Feedback 2008&#8242;</a> series.)</p>
<p>
Not surprisingly, there was a lot of community feedback <a href="http://fantasai.inkedblade.net/style/discuss/wasp-feedback-2008#layout">asking for better layout mechanisms</a>.  Actually, people were asking for any decent layout mechanism at all, which CSS has historically lacked.  Floats mostly work, but they&#8217;re a hack and can be annoyingly fragile even when you ignore old-browser bugs.  Positioning works in limited cases, but does not handle web-oriented layout at all well.
</p>
<p>
Why do we use floats for layout, anyway?  <code>clear</code>.  That&#8217;s pretty much the whole answer.  The unique in-flow/out-of-flow nature of floats means they interact with each other and with the normal flow, which means they can be cleared, which makes them useful.  Because with <code>clear</code>, we can float layout blocks around and then push other non-floated blocks, like footers, below the floats.
</p>
<p>
Positioning, of course, permits total layout freedom in the sense that you can put a layout block anywhere with respect to its containing block.  The downfall is that absolutely positioned elements are entirely out of the normal flow, so they can&#8217;t stay out of each others&#8217; way like floats do, and you can&#8217;t clear anything with respect to a positioned element.  If there had been a <code>position-clear</code> or its equivalent from the outset, we&#8217;d never have bothered with floats.
</p>
<p>
(And if we can just add <code>position-clear</code> to CSS, that would be completely awesome.  It&#8217;s <a href="http://www.shauninman.com/archive/2006/05/22/clearance_position_inline_absolute">been done with JavaScript</a> and it will most likely be done again and better.  It wouldn&#8217;t even be that hard to implement, at least for 99.5% of cases.)
</p>
<p>
All this is why the old &#8220;only use tables for layout&#8221; argument keeps coming up over and over: strip away the overheated rhetoric and obvious link-baiting, and you find the core of a real need.  Because as powerful as CSS can be, table cells do certain things very easily that CSS makes very, very hard.  Cells stretch vertically, keeping equal heights as a matter of their intrinsic nature.  They stay out of each others&#8217; way, while still being allowed to sit next to each other and use any sizing dimensions.  They tie their layout to their parent elements, and vice versa.
</p>
<p>
There are <em>no</em> equivalents in CSS.  There have been various very clever attempts to replicate bits and pieces of those capabilities using CSS.  What CSS does, it does very well: if you don&#8217;t need equal-height layout blocks, then no problem.  If you do, it&#8217;s a massive pain.  Clever techniques provide substitutes, but can&#8217;t replace what tables already do.
</p>
<p>
And please, let&#8217;s put the whole &#8220;<code>display: table-cell</code> will grant those abilities through CSS&#8221; to rest.  Saying that is just saying &#8220;use tables for layout&#8221; with different words.  Turning a bunch of <code>div</code>s or list items or whatever into table-role boxes is no better than just using table markup in the first place, and it&#8217;s arguably worse.  Using element names other than <code>table</code> and <code>td</code> to create layout tables, and then claiming it&#8217;s not using tables for layout, borders on self-deception.
</p>
<p>
Not to mention doing things that way means you&#8217;re doing your layout in a highly source-order-dependent fashion, which was one of the things about table layout we were trying to get away from in the first place.
</p>
<p>
So how do we get really powerful source-order-independent layout?  I wish I knew.  The <a href="http://www.w3.org/TR/css3-layout/">Advanced Layout module</a> has been sitting around for a while now, and even if you&#8217;re a fan of defining layout as ASCII art&#8212;which I find repels and appeals in equal measure, but that&#8217;s probably just me&#8212;there appears to be close to zero implementor interest.  So how do we get those abilities in a form that implementors will, y&#8217;know, <em>implement</em>?  I don&#8217;t know.  I don&#8217;t <em>care</em>.  We just need it, and have needed it for a good decade or so.  Without it, CSS is a styling language but not a layout language.  We&#8217;ve bent it into being something close to a layout language, which is nice but not really ideal.
</p>
<p>
Maybe CSS isn&#8217;t the place for this.  Maybe there needs to be a new layout language that can be defined and implemented without regard to the constraints of the existing CSS syntax rules, without worrying about backwards compatibility.  Maybe that way we can not only get strong layout but also arbitrary shapes, thus leaving behind the rectangular prison that&#8217;s defined the web for almost two decades.
</p>
<p>
I don&#8217;t have a concrete idea to propose here, because it&#8217;s not up to us any more.  A solution was worked out over the course of several years and then found wanting by the implementors.  Really, it&#8217;s up to the implementors to figure it out now.  I personally would like to just lock the browser teams from Microsoft, Mozilla, Opera, and Apple in a room and not let them out until they&#8217;ve defined something that works and they&#8217;ve all agreed to implement soonest.  I might even supply food and water.
</p>
<p>
And yes, I just advocated doing this outside the W3C process.  Why wouldn&#8217;t I?  The process has, in the last decade, not produced anything even remotely resembling an answer to this problem.  Time to try another path and see if it gets any closer to the goal.
</p>
<p>
No doubt someone&#8217;s going to spin this as &#8220;See, even noted standards zealot Eric Meyer now says CSS is flawed!&#8221;&#8212;only they&#8217;ll be wrong because this isn&#8217;t a <em>now</em> thing.  I&#8217;ve been saying this for years in interviews, in person, and in general.  Any time someone asks me what CSS is missing or should do better, the answer has always been a variant on &#8220;a strong layout system&#8221;.  I&#8217;ve been saying it for at least a decade.  So I&#8217;m not saying it <em>now</em>.  I&#8217;m saying it <em>again</em>.  And again and again and again and&#8230;
</p>
<p>
If I sound frustrated, it&#8217;s because I am, and have been for a good long while.  I&#8217;m not the only one.  It rankles to have CSS be, as Winston Churchill would have put it, the worst form of layout except for all the others that have been tried.
</p>]]></content:encoded>
			<wfw:commentRss>http://meyerweb.com/eric/thoughts/2009/02/17/wanted-layout-system/feed/</wfw:commentRss>
		<slash:comments>131</slash:comments>
		</item>
		<item>
		<title>An Event Apart and HTML 5</title>
		<link>http://meyerweb.com/eric/thoughts/2009/01/02/an-event-apart-and-html-5/</link>
		<comments>http://meyerweb.com/eric/thoughts/2009/01/02/an-event-apart-and-html-5/#comments</comments>
		<pubDate>Fri, 02 Jan 2009 16:01:59 +0000</pubDate>
		<dc:creator>Eric Meyer</dc:creator>
				<category><![CDATA[(X)HTML]]></category>
		<category><![CDATA[An Event Apart]]></category>
		<category><![CDATA[Browsers]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://meyerweb.com/?p=982</guid>
		<description><![CDATA[A bit of commentary about the choice of markup language for the brand-new An Event Apart design.]]></description>
			<content:encoded><![CDATA[<p>
The new Gregorian year has brought a striking new <a href="http://zeldman.com/" rel="friend colleague co-worker met">Big Z</a> design to <a href="http://aneventapart.com/">An Event Apart</a>, along with the detailed schedule for our first show and the opening of <a href="https://store.aneventapart.com/">registration for all four shows</a> of the year.  Jeffrey has <a href="http://www.zeldman.com/2009/01/01/an-event-apart-redesigned/">written a bit</a> about the thinking that went into the design already, and I expect more to come.  If you want <em>all</em> the juicy details, he&#8217;ll be talking about it at AEA, as a glance at the top of <a href="http://aneventapart.com/2009/seattle/#schedule">the Seattle schedule</a> will tell you.  And right after that?  An hour of me talking about coding the design he created.
</p>
<p>
One of the things I&#8217;ll be talking about is the choice of markup language for the site, which ended up being <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/">HTML 5</a>.  In the beginning, I chose HTML 5 because I wanted to do something like this:
</p>

<pre>
&lt;li&gt;
&lt;a href="/2009/seattle/"&gt;
&lt;h2&gt;&lt;img src="/i/09/city-seattle.jpg" alt="Seattle" /&gt;&lt;/h2&gt;
&lt;h3&gt;May 4&#8212;5, 2009&lt;/h3&gt;
&lt;p&gt;Bell Harbor International Conference Center&lt;/p&gt;
&lt;/a&gt;
&lt;/li&gt;
</pre>

<p>
Yes, <a href="http://dev.w3.org/html5/spec/Overview.html#the-a-element">that&#8217;s legal in HTML 5</a>, thanks to <a href="http://www.brucelawson.co.uk/2008/any-element-linking-in-html-5/">the work done</a> by <a href="http://www.brucelawson.co.uk/" rel="friend colleague met">Bruce Lawson</a> in response to my <a href="http://meyerweb.com/eric/thoughts/2008/07/23/any-element-linking-demo/">href-anywhere agitation</a>.  It isn&#8217;t what I&#8217;d consider ideal, structurally, but it&#8217;s close.  It sure beats having to make the content of every element its own hyperlink, each one pointing at the exact same destination:
</p>

<pre>
&lt;li&gt;
&lt;h2&gt;&lt;a href="/2009/seattle/"&gt;&lt;img src="/i/09/city-seattle.jpg" alt="Seattle" /&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;h3&gt;&lt;a href="/2009/seattle/"&gt;May 4&#8212;5, 2009&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;&lt;a href="/2009/seattle/"&gt;Bell Harbor International Conference Center&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
</pre>

<p>
I mean, that&#8217;s just dumb.  Ideally, I could drop an <code>href</code> on the <code>li</code> instead of having to wrap an <code>a</code> element around the content, but baby steps.  Baby steps.
</p>
<p>
So as Bruce discovered, pretty much all browsers will already let you wrap <code>a</code> elements around other stuff, so it got added to HTML 5.  And when I tried it, it worked, clickably speaking.  That is, all the elements I wrapped became part of one big hyperlink, which is what I wanted.
</p>
<p>
What I didn&#8217;t want, though, was the randomized layout weirdness that resulted once I started styling the descendants of the link.  Sometimes everything would lay out properly, and other times the bits and pieces were all over the place.  I could (randomly) flip back and forth between the two just by repeatedly hitting reload.  I thought maybe it was the heading elements that were causing problems, so I converted them all to classed paragraphs.  Nope, same problems.  So I converted them all to classed <code>span</code>s and that solved the problem.  The layout became steady and stable.
</p>
<p>
I was happy to get the layout problems sorted out, obviously.  Only, at that point, I wasn&#8217;t doing anything that required HTML 5.  Wrapping classed <code>span</code>s in links in the place of other, more semantic elements?  Yeah, <em>that&#8217;s</em> original.  It&#8217;s just as original as the coding pattern of &#8220;slowly leaching away the document&#8217;s semantics in order to make it, at long last and after much swearing, consistently render as intended&#8221;.  I&#8217;m sure one or two of you know what that&#8217;s like.
</p>
<p>
As a result, I could have gone back to XHTML 1.1 or even HTML 4.01 without incident.  In fact, I almost did, but in the end I decided to stick with HTML 5.  There were two main reasons.
</p>

<ol>
<li>
<p>First, AEA is all about the current state and near future of web design and development.  HTML 5 is already here and in use, and its use will grow over time.  We try to have the site embody the conference itself as much as possible, so using HTML 5 made some sense.</p>
</li>
<li>
<p>
I wanted to try HTML 5 out for myself under field conditions, to get a sense of how similar or dissimilar it is to what&#8217;s gone before.  Turns out the answers are &#8220;very much so&#8221; to the former and &#8220;frustratingly so&#8221; to the latter, assuming you&#8217;re familiar with XHTML.  The major rules are pretty much all the same: mind your trailing slashes on empty elements, that kind of thing.  But you know what the funniest thing about HTML 5 is?  It&#8217;s the little differences.  Like not permitting a <code>value</code> attribute on an image <code>submit</code>.  That one came as a rather large surprise, and as a result our <a href="http://aneventapart.com/subscribe/">subscribe page</a> is XHTML 1.0 Transitional instead of HTML 5.  (Figuring out how to work around this in HTML 5 is on my post-launch list of things to do.)
</p>
<p>
Oh, and we&#8217;re back to being case-insensitive.  <code>&lt;P Class="note"&gt;</code> is just as valid as <code>&lt;p class="note"&gt;</code>.  Having already fought the Casing Wars once, this got a fractional shrug from me, but some people will probably be all excited that they can uppercase their element names again.  I know I would&#8217;ve been, oh, six or seven years ago.
</p>
<p>
Incidentally, I used <a href="http://validator.nu/">validator.nu</a> to check my work.  It seemed the most up to date, but there&#8217;s no guarantee it&#8217;s perfectly accurate.  Ged knows every other validator I&#8217;ve ever used has eventually been shown to be inaccurate in one or more ways.
</p>
</li>
</ol>

<p>
I get the distinct impression that use of HTML 5 is going to cause equal parts of comfort (for the familiar parts) and eye-watering rage (for the apparently idiotic differences).  Thus it would seem the HTML 5 Working Group is succeeding quite nicely at capturing the current state of browser behavior.  Yay, I guess?
</p>
<p>
And then there was the part where I got really grumpy about not being able to nest a hyperlink element inside another hyperlink element&#8230; but that, like so many things referenced in this post, is a story for another day.
</p>
]]></content:encoded>
			<wfw:commentRss>http://meyerweb.com/eric/thoughts/2009/01/02/an-event-apart-and-html-5/feed/</wfw:commentRss>
		<slash:comments>70</slash:comments>
		</item>
		<item>
		<title>JavaScript Will Save Us All</title>
		<link>http://meyerweb.com/eric/thoughts/2008/10/22/javascript-will-save-us-all/</link>
		<comments>http://meyerweb.com/eric/thoughts/2008/10/22/javascript-will-save-us-all/#comments</comments>
		<pubDate>Wed, 22 Oct 2008 13:05:57 +0000</pubDate>
		<dc:creator>Eric Meyer</dc:creator>
				<category><![CDATA[(X)HTML]]></category>
		<category><![CDATA[Browsers]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[DOM]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Standards]]></category>

		<guid isPermaLink="false">http://meyerweb.com/?p=953</guid>
		<description><![CDATA[Most of the browser development work these days seems to be going into JavaScript performance.  That's a good thing for CSS3 and HTML5.]]></description>
			<content:encoded><![CDATA[<p>
A while back, I woke up one morning thinking, <i>John Resig&#8217;s got some great CSS3 support in <a href="http://jquery.com/">jQuery</a> but it&#8217;s all forced into JS statements.  I should ask him if he could set things up like <a href="http://dean.edwards.name/">Dean Edwards</a>&#8216; <a href="http://dean.edwards.name/ie7/">IE7 script</a> so that the JS scans the author&#8217;s CSS, finds the advanced selectors, does any necessary backend juggling, and makes CSS3 selector support Transparently Just Work.  And then he could put that back into jQuery.</i>
</p>
<p>
And then, after breakfast, I fired up my feed reader and saw <a href="http://simonwillison.net/" rel="acquaintance met">Simon Willison</a>&#8216;s <a href="http://simonwillison.net/2008/Aug/24/jeresigs/">link</a> to John Resig&#8217;s nascent <a href="http://github.com/jeresig/sizzle/tree/master">Sizzle</a> project.
</p>
<p>
I swear to Ged this is how it happened.
</p>
<p>
Personally, I can&#8217;t wait for Sizzle to be finished, because I&#8217;m absolutely going to use it and recommend its use far and wide.  As far as I&#8217;m concerned, though, it&#8217;s a first step into a larger world.
</p>
<p>
Think about it: most of the browser development work these days seems to be going into JavaScript performance.  Those engines are being overhauled and souped up and tuned and re-tuned to the point that performance is improving by orders of magnitude.  Scanning the DOM tree and doing things to it, which used to be slow and difficult, is becoming lightning-fast and easy.
</p>
<p>
So why not write JS to implement <a href="http://www.css3.info/preview/multiple-backgrounds/">multiple background-image</a> support in all browsers?  All that&#8217;s needed is to scan the CSS, find instances of multiple-image backgrounds, and then dynamically add <code>div</code>s, one per extra background image, to get the intended effect.
</p>
<p>
Just like that, you&#8217;ve used the browser&#8217;s JS to extend its CSS support.  This approach advances standards support in browsers from the ground up, instead of waiting for the browser teams to do it for us.
</p>
<p>
I suspect that not quite everything in CSS3 will be amenable to this approach, but you might be surprised.  Seems to me that you could do <a href="http://www.css3.info/preview/background-size/">background sizing</a> with some <code>div</code>-and-positioning tricks, and <code>text-shadow</code> could be supportable using a sIFR-like technique, though line breaks would be a bear to handle.  <a href="http://www.w3.org/TR/2003/CR-css3-color-20030514/#rgba-color">RGBa</a> and <a href="http://www.w3.org/TR/2003/CR-css3-color-20030514/#hsla-color">HSLa</a> colors could be simulated with creative element reworking and <code>opacity</code>, and HSL itself could be (mostly?) supported in IE with HSL-to-RGB calculations.  And so on.
</p>
<p>
There are two primary benefits here.  The first is obvious: we can stop waiting around for browser makers to give us what we want, thanks to their efforts on JS engines, and start using the advanced CSS we&#8217;ve been hearing about for years.  The second is that the process of finding out which parts of the spec work in the real world, and which fall down, will be greatly accelerated.  If it turns out nobody uses (say) <code>background-clip</code>, even given its availability via a CSS/JS library, then that&#8217;s worth knowing.
</p>
<p>
What I wonder is whether the W3C could be convinced that two JavaScript libraries supporting a given CSS module would constitute &#8220;interoperable implementations&#8221;, and thus allow the specification to move forward on the process track.  Or heck, what about considering a single library getting consistent support in two or more browsers as interoperable?  There&#8217;s a chance here to jump-start the entire process, front to back.
</p>
<p>
It is true that browsers without JavaScript will not get the advanced CSS effects, but older browsers don&#8217;t get our current CSS, and we use it anyway.  (Still older browsers don&#8217;t understand any CSS at all.)  It&#8217;s the same problem we&#8217;ve always faced, and everyone will face it differently.
</p>
<p>
We don&#8217;t have to restrict this to CSS, either.  As I showed with my <a href="http://meyerweb.com/eric/html-xhtml/html5-linking-demo.html"><code>href</code>-anywhere demo</a>, it&#8217;s possible to extend markup using JS.  (No, not without breaking validation: you&#8217;d need a custom DTD for that.  Hmmm.)  So it would be possible to use JS to, say, add <code>audio</code> and <code>video</code> support to currently-available browsers, and even older browsers.  All you&#8217;d have to do is convert the HTML5 element into HTML4 elements, dynamically writing out the needed attributes and so forth.  It might not be a perfect 1:1 translation, but it would likely be serviceable&#8212;and would tear down some of the highest barriers to adoption.
</p>
<p>
There&#8217;s more to consider, as well: the ability to create our very own &#8220;standards&#8221;.  Maybe you&#8217;ve always wanted a <code>text-shake</code> property, which jiggles the letters up and down randomly to look like the element got shaken up a bit.  Call it <code>-myCSS-text-shake</code> or something else with a proper &#8220;vendor&#8221; prefix&#8212;we&#8217;re <em>all</em> vendors now, baby!&#8212;and go to town.  Who knows?  If a property or markup element or attribute suddenly takes off like wildfire, it might well make it into a specification.  After all, the HTML 5 Working Group is now explicitly set up to prefer things which are implemented over things that are not.  Perhaps the CSS Working Group would move in a similar direction, given a world where we were all experimenting with our own ideas and seeing the best ideas gain widespread adoption.
</p>
<p>
In the end, <a href="http://www.flickr.com/photos/rohdesign/2951537617/">as I said in Chicago</a> last week, the triumph of standards (specifically, the DOM standard) will permit us to push standards support forward <em>now</em>, and save some standards that are currently dying on the vine.  All we have to do now is start pushing.  Sizzle is a start.  Who will take the next step, and the step after that?
</p>
]]></content:encoded>
			<wfw:commentRss>http://meyerweb.com/eric/thoughts/2008/10/22/javascript-will-save-us-all/feed/</wfw:commentRss>
		<slash:comments>67</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
