<?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>Broken Links</title>
	<atom:link href="http://www.broken-links.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.broken-links.com</link>
	<description>Peter Gasston&#039;s blog on web development and technologies</description>
	<lastBuildDate>Sun, 16 Jun 2013 17:36:50 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
	<atom:link rel='hub' href='http://www.broken-links.com/?pushpress=hub'/>
		<item>
		<title>CSS Day and Responsive Design Workflow</title>
		<link>http://www.broken-links.com/2013/06/16/css-day-and-responsive-design-workflow/</link>
		<comments>http://www.broken-links.com/2013/06/16/css-day-and-responsive-design-workflow/#comments</comments>
		<pubDate>Sun, 16 Jun 2013 17:36:50 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Books]]></category>
		<category><![CDATA[Reviews]]></category>
		<category><![CDATA[book]]></category>
		<category><![CDATA[conference]]></category>
		<category><![CDATA[css day]]></category>
		<category><![CDATA[responsive design]]></category>
		<category><![CDATA[review]]></category>

		<guid isPermaLink="false">http://www.broken-links.com/?p=2232</guid>
		<description><![CDATA[I’ve just returned from a few days in Amsterdam, where I was fortunate enough to be part of the first (and only?) CSS Day, an event organised by the team behind Mobilism and Fronteers, who are consummately professional and deserve huge congratulations and thanks for all their work. The conference had the aim of diving [...]]]></description>
				<content:encoded><![CDATA[<p>I’ve just returned from a few days in Amsterdam, where I was fortunate enough to be part of the first (and only?) <a href="http://cssday.nl/">CSS Day</a>, an event organised by the team behind Mobilism and Fronteers, who are consummately professional and deserve huge congratulations and thanks for all their work. The conference had the aim of diving deep into CSS through each of the eight speakers discussing a module (or modules) of the CSS spec. My chosen subject was <a href="https://speakerdeck.com/stopsatgreen/animations-and-transitions">Animations and Transitions</a>; my slides are online now, video should follow shortly.</p>
<p>The day before the conference I gave a whole-day workshop on Responsive Web Design, teaching design and development approaches and — more importantly — a new workflow more adapted to the demands of the new way of working. I was helped hugely in this by the fact that I’d recently finished reading <a href="http://www.the-haystack.com/">Stephen Hay</a>’s new book, <a href="http://responsivedesignworkflow.com/">Responsive Design Workflow</a>.</p>
<p><span id="more-2232"></span></p>
<p>Disclaimers: I received this book for free from the publisher; I know Stephen (mostly from online); and he recently gave my own new book <a href="http://www.the-haystack.com/2013/06/04/book-review-the-modern-web/">a very nice review</a>. With all that you could question my impartiality, but while I don’t claim to be free from bias, it’s very lucky indeed that this is a great book in its own rights and I don’t have any conflict about recommending it.</p>
<p>The book is broken into eleven chapters, ten of which each cover a step in the new process that Stephen uses. Highly detailed wireframes are out, as are static Photoshop designs, being replaced by more content-led phases: a content inventory, rough content-led wireframes with breakpoint graphs, early stage markup, and lots of rapid prototyping.</p>
<p>Next the book goes on to detail new approaches to design, starting with designing in the browser and creating automated screenshots, and moving on to creating style guides and pattern libraries. All of this is carefully considered, and makes perfect sense in the light of the different way we have to work in order to put responsive design at the heart of our builds.</p>
<p>It must be stressed that this book is not about <em>the</em> responsive workflow, but <em>a</em> responsive workflow; one that Stephen has adopted in the projects on which he works. At times the book becomes very detailed in describing some of the software and processes he uses, which may not be relevant to the way you work; but he makes clear that this is not going to work for everybody, and that you should be planning your own way to suit the particular methods of your organisation.</p>
<p>And that’s what makes this a very important book: it’s a considered, detailed, cogent examination of the shortcomings of the way we work and a proposal for a better way. Even if you think every step he proposes is unsuitable for you (which I find <em>highly</em> unlikely) you’ll at least be forced into considering an alternative, because these problems are real and require a solution.</p>
<p>It’s also clearly and informally written, with plenty of grace, wit and insight. It leaves me quite envious.</p>
 <p><a href="http://www.broken-links.com/?flattrss_redirect&amp;id=2232&amp;md5=885149237376e51f03c81af773a69413" title="Flattr" target="_blank"><img src="http://www.broken-links.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.broken-links.com/2013/06/16/css-day-and-responsive-design-workflow/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<atom:link rel="payment" title="Flattr this!" href="https://flattr.com/submit/auto?user_id=12916&amp;popout=1&amp;url=http%3A%2F%2Fwww.broken-links.com%2F2013%2F06%2F16%2Fcss-day-and-responsive-design-workflow%2F&amp;language=en_GB&amp;category=text&amp;title=CSS+Day+and+Responsive+Design+Workflow&amp;description=I%E2%80%99ve+just+returned+from+a+few+days+in+Amsterdam%2C+where+I+was+fortunate+enough+to+be+part+of+the+first+%28and+only%3F%29+CSS+Day%2C+an+event+organised+by+the+team...&amp;tags=book%2Cconference%2Ccss+day%2Cresponsive+design%2Creview%2Cblog" type="text/html" />
	</item>
		<item>
		<title>Removing anonymous event listeners</title>
		<link>http://www.broken-links.com/2013/05/22/removing-event-listeners-with-anonymous-functions/</link>
		<comments>http://www.broken-links.com/2013/05/22/removing-event-listeners-with-anonymous-functions/#comments</comments>
		<pubDate>Wed, 22 May 2013 21:00:57 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Basics]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Events]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[listeners]]></category>

		<guid isPermaLink="false">http://www.broken-links.com/?p=2207</guid>
		<description><![CDATA[I recently ran into a problem involving the removeEventListener() method, which caused me a good half an hour of confusion before a lightbulb appeared above my head and I was enlightened by a solution — a solution which, it must be said, is very obvious in hindsight. So doubtless many people know this already, but [...]]]></description>
				<content:encoded><![CDATA[<p>I recently ran into a problem involving the <code>removeEventListener()</code> method, which caused me a good half an hour of confusion before a lightbulb appeared above my head and I was enlightened by a solution — a solution which, it must be said, is very obvious in hindsight. So doubtless many people know this already, but I’m recording it here along with another approach I thought of afterwards, in the hope that they may be useful to someone in the future.</p>
<p><span id="more-2207"></span></p>
<p>The issue at hand is this: to add an event listener to an element, you use the <code>addEventListener()</code> method with the type of event, and the name of the listener — most often, a call to a pre-defined function:</p>
<pre>el.addEventListener('click', foo);</pre>
<p>When you want to remove the listener, you use the <code>removeEventListener()</code> method, with the same arguments to ensure that only the specified event and listener combination is removed:</p>
<pre>el.removeEventListener('click', foo);</pre>
<p>Simple. But it becomes less straightforward when you use an anonymous function as the listener, perhaps because you want to call another function and pass arguments to it:</p>
<pre>el.addEventListener('click', function() {
  foo(bar,baz);
});</pre>
<p>In order to remove this listener you have to know the name of it. But it’s anonymous! What are we to do? The answer is ridiculously simple: <em>don’t use anonymous functions</em>. You could instead name the function in the listener, then remove it when the function has run:</p>
<pre>el.addEventListener('click', function _func() {
  foo(bar,baz);
  el.removeEventListener('click', _func);
});</pre>
<p>Alternatively, you could assign the function to a variable, then use that variable as the listener:</p>
<pre>var _func = function() {
  foo(bar,baz);
}
el.addEventListener('click', _func);</pre>
<p>And remove it by using the variable name again:</p>
<pre>el.removeEventListener('click', _func);</pre>
<p>These solutions seem so obvious that I debated whether it was worth recording them here, but in my searches I couldn’t find them listed anywhere; I hope that by writing them up I’ll save someone some searching time in the future.</p>
 <p><a href="http://www.broken-links.com/?flattrss_redirect&amp;id=2207&amp;md5=5b46e25d1fa70af6b2bb155e83cf316a" title="Flattr" target="_blank"><img src="http://www.broken-links.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.broken-links.com/2013/05/22/removing-event-listeners-with-anonymous-functions/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<atom:link rel="payment" title="Flattr this!" href="https://flattr.com/submit/auto?user_id=12916&amp;popout=1&amp;url=http%3A%2F%2Fwww.broken-links.com%2F2013%2F05%2F22%2Fremoving-event-listeners-with-anonymous-functions%2F&amp;language=en_GB&amp;category=text&amp;title=Removing+anonymous+event+listeners&amp;description=I+recently+ran+into+a+problem+involving+the+removeEventListener%28%29+method%2C+which+caused+me+a+good+half+an+hour+of+confusion+before+a+lightbulb+appeared+above+my+head+and+I+was...&amp;tags=Events%2Cjavascript%2Clisteners%2Cblog" type="text/html" />
	</item>
		<item>
		<title>It’s CSS Day next month!</title>
		<link>http://www.broken-links.com/2013/05/22/its-css-day-next-month/</link>
		<comments>http://www.broken-links.com/2013/05/22/its-css-day-next-month/#comments</comments>
		<pubDate>Wed, 22 May 2013 09:09:25 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[Events]]></category>
		<category><![CDATA[conference]]></category>
		<category><![CDATA[css day]]></category>
		<category><![CDATA[workshop]]></category>

		<guid isPermaLink="false">http://www.broken-links.com/?p=2196</guid>
		<description><![CDATA[Next month I’ll have the pleasure of taking part in CSS Day in Amsterdam, not once, but twice. On Friday 14th June I’ll be on stage alongside a truly stellar line-up of speakers: Eric Meyer, Bert Bos, Stephen Hay, Divya Manian, Tab Atkins, Daniel Glazman and Lea Verou. Each of us will be looking in [...]]]></description>
				<content:encoded><![CDATA[<p>Next month I’ll have the pleasure of taking part in <a href="http://cssday.nl/">CSS Day</a> in Amsterdam, not once, but twice. On Friday 14th June I’ll be on stage alongside a truly stellar line-up of speakers: Eric Meyer, Bert Bos, Stephen Hay, Divya Manian, Tab Atkins, Daniel Glazman and Lea Verou. Each of us will be looking in detail at a specific module (or modules) of the CSS spec; my talk will be on the Animations and Transitions modules. If you’re into CSS in a big way, this day is one you won’t want to miss.</p>
<p>On the previous day, Thursday 13th June, I’ll be giving a one-day Responsive Web Design workshop, where I’ll be teaching the full process of creating a responsive website: planning and strategy, prototyping, tools, design deliverables, and, of course, coding. Alternatively, if your CSS is not quite up to scratch and you need a refresher before the conference, Eric Meyer will be giving a workshop which will teach you all you need to know.</p>
<p>Each workshop costs €300, and the conference day costs €250 (Dutch VAT of 21% will be added to both). <a href="http://cssday.nl/">Full details, programme and tickets are all on CSSDay.nl</a>, along with a nice little Easter egg I found out about today: click on a speakers name on the <a href="http://cssday.nl/programme">Programme page</a> to see some live examples of their chosen subject!</p>
<p>Oh, and as if my conference and some fantastic talks weren’t enough, as a bonus you get to spend a few days in beautiful Amsterdam. I’m really excited to be a part of this, and hope to see you there!</p>
 <p><a href="http://www.broken-links.com/?flattrss_redirect&amp;id=2196&amp;md5=3a6022d24c633a4b6a158f59cb8b2154" title="Flattr" target="_blank"><img src="http://www.broken-links.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.broken-links.com/2013/05/22/its-css-day-next-month/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<atom:link rel="payment" title="Flattr this!" href="https://flattr.com/submit/auto?user_id=12916&amp;popout=1&amp;url=http%3A%2F%2Fwww.broken-links.com%2F2013%2F05%2F22%2Fits-css-day-next-month%2F&amp;language=en_GB&amp;category=text&amp;title=It%E2%80%99s+CSS+Day+next+month%21&amp;description=Next+month+I%E2%80%99ll+have+the+pleasure+of+taking+part+in+CSS+Day+in+Amsterdam%2C+not+once%2C+but+twice.+On+Friday+14th+June+I%E2%80%99ll+be+on+stage+alongside+a+truly+stellar...&amp;tags=conference%2Ccss%2Ccss+day%2CEvents%2Cworkshop%2Cblog" type="text/html" />
	</item>
		<item>
		<title>Switching from native to web apps: an experiment</title>
		<link>http://www.broken-links.com/2013/05/16/switching-from-native-to-web-apps-an-experiment/</link>
		<comments>http://www.broken-links.com/2013/05/16/switching-from-native-to-web-apps-an-experiment/#comments</comments>
		<pubDate>Thu, 16 May 2013 10:30:02 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Miscellanea]]></category>

		<guid isPermaLink="false">http://www.broken-links.com/?p=2183</guid>
		<description><![CDATA[I recently had call to do a factory reset on my phone, and as I began the process of reinstalling all my apps again decided to try an experiment instead: to see if mobile web apps (or, sites) were up to the job of replacing native apps. With the forthcoming release of Firefox OS this [...]]]></description>
				<content:encoded><![CDATA[<p>I recently had call to do a factory reset on my phone, and as I began the process of reinstalling all my apps again decided to try an experiment instead: to see if mobile web apps (or, <a href="http://adactio.com/journal/6246/">sites</a>) were up to the job of replacing native apps. With the forthcoming release of <a href="http://www.mozilla.org/en-US/firefox/partners/#os">Firefox OS</a> this is something I’ve been very curious about, but within days I was back to using native again. I’ll explain why, but lay out some of the more positive findings before I do. Note that I was using Chrome on Android for my experiment, but I think the findings should hold true for most browser and OS combos.</p>
<p><span id="more-2183"></span></p>
<h2>The positives</h2>
<p>Some mobile apps are extremely well made and I would have no difficulty at all in switching to them today. Of special note are <a href="https://mobile.twitter.com/">Twitter</a> and <a href="https://m.facebook.com/">Facebook</a>, which have — as far as I can tell — full feature parity (in all the features I use, anyway) with their native siblings. Twitter in particular have taken a lot of time and effort to provide a first-class experience on the mobile web.</p>
<p><a href="http://m.guardian.co.uk/">The Guardian’s mobile site</a> is also beautifully designed — better even than the native app, in my opinion — and <a href="http://m.bbc.co.uk/news">BBC News</a> and <a href="http://m.bbc.co.uk/sport">Sport</a> are also of the highest quality. Google’s mobile apps — Gmail, Calendar, Reader, and Maps — are not quite as slick as the native versions, but are undoubtedly very functional and usable.</p>
<h2>The negatives</h2>
<p>A few of the apps I use frequently were just not up to scratch on mobile. I have to single out <a href="https://foursquare.com/mobile/">Foursquare</a> who, somewhat surprisingly for such a mobile-focused service, have a shockingly poor mobile web offering, not optimised for modern phones at all. The Google+ app was pretty poor while I was testing, although a new version has just been released which seems much better. Instagram’s mobile site is okay, but is purely for consumption — there’s no way to add new photos. But these apps were nice to haves rather than essential, so I could have done without them if I’d switched to an all-web OS.</p>
<p>The problem came with the lack of system settings. For example, <a href="http://www.onderhond.com/features/web-musings/social-communication-direct-vs-subscription">unlike Niels Matthijs</a> I like to have notifications for certain content, and web apps on Android don’t have access to notifications.</p>
<p>More seriously, there is no integration between apps at all; unlike with Android’s Intents, I can’t begin a task in one app then send it to another; each mobile web app is an island unto itself, so I can’t tweet a photo from my gallery, or save a link to Pocket or Evernote.</p>
<p>The biggest annoyance, however, was that running an instance of an app wouldn’t make it visible in other tabs; for example, if I had Twitter in tab A then followed a link to a Tweet in tab B, a new instance of Twitter would open in tab C. My tabs soon filled up with multiple instances of the same app.</p>
<h2>The conclusion</h2>
<p>It’s likely that if I were coming at a web-based OS afresh I would develop new habits and ways of working to achieve my behavioural goals. However, as a convert from a system that works for me, with inter-app operation and notifications, I found myself extremely limited and became frustrated quite quickly. This means that I don’t feel I can switch to web apps permanently right now, and that’s a shame because in some cases I didn’t miss native apps at all.</p>
<p>All the problems I mentioned above are problems that Firefox OS will have to solve, and I believe that they have the APIs to do it; however, if an outreach process to get big apps to use <a href="https://hacks.mozilla.org/2013/01/introducing-web-activities/">Web Activities</a> and <a href="http://notifications.spec.whatwg.org/">Notifications</a> isn’t underway already, it should be started very soon.</p>
<p><b>Update:</b> It occurred to me after writing this that my mental model of what I expect from apps would probably be very different if I were an iOS user, where each app is essentially an island anyway, and notifications are generally much fewer or non-existent. However, the issue with multiple instances of an app being opened in new tabs is annoying regardless of your current choice of platform.</p>
 <p><a href="http://www.broken-links.com/?flattrss_redirect&amp;id=2183&amp;md5=a907449fcf5855d8ed6fe898f199b83b" title="Flattr" target="_blank"><img src="http://www.broken-links.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.broken-links.com/2013/05/16/switching-from-native-to-web-apps-an-experiment/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<atom:link rel="payment" title="Flattr this!" href="https://flattr.com/submit/auto?user_id=12916&amp;popout=1&amp;url=http%3A%2F%2Fwww.broken-links.com%2F2013%2F05%2F16%2Fswitching-from-native-to-web-apps-an-experiment%2F&amp;language=en_GB&amp;category=text&amp;title=Switching+from+native+to+web+apps%3A+an+experiment&amp;description=I+recently+had+call+to+do+a+factory+reset+on+my+phone%2C+and+as+I+began+the+process+of+reinstalling+all+my+apps+again+decided+to+try+an+experiment+instead%3A...&amp;tags=blog" type="text/html" />
	</item>
		<item>
		<title>Some stats on OS and browser share</title>
		<link>http://www.broken-links.com/2013/05/03/mobile-stats/</link>
		<comments>http://www.broken-links.com/2013/05/03/mobile-stats/#comments</comments>
		<pubDate>Fri, 03 May 2013 10:30:11 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[browsers]]></category>
		<category><![CDATA[OS]]></category>
		<category><![CDATA[analytics]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[os]]></category>
		<category><![CDATA[stats]]></category>

		<guid isPermaLink="false">http://www.broken-links.com/?p=2130</guid>
		<description><![CDATA[Last week on Twitter I shared some browser and OS statistics from a site I manage. These turned out to be quite popular, so I’ve decided to expand on them a little further, and also add the stats from another site I manage, to broaden the base numbers a little. I’m not trying to make [...]]]></description>
				<content:encoded><![CDATA[<p>Last week on Twitter I shared some browser and <abbr>OS</abbr> statistics from a site I manage. These turned out to be quite popular, so I’ve decided to expand on them a little further, and also add the stats from another site I manage, to broaden the base numbers a little. I’m not trying to make any point here, just sharing a little bit of analytics data. If there’s any interest in my doing so, I’ll provide further updates in the future; leave a comment if there’s anything in particular you’d like to know.</p>
<p><span id="more-2130"></span></p>
<h2>Reporting notes</h2>
<p>Stats are taken from Google Analytics from the period 1st January 2013 to 26th April 2013 (it took me a few days to write this post). I’m going to give the mean average of stats between the two sites, noting where there is significant variation — and I’ll speculate on the variation at the end of the post.</p>
<p>I decided not to use the stats from this blog as it tends to skew towards a very non-typical audience, consisting in large part of the tech-savvy and early adopters. Instead I’m using two sites I manage which I think have a more ‘normal’ set of visitors (no offence intended, dear reader).</p>
<p>To keep the sites anonymous I’ll refer to them as <em>Site A</em> and <em>Site B</em>. Site A is for news and opinions on Arsenal football club. It’s London-centric but has an international audience, and had an average of 1,935 unique visitors per day in the selected period. Site B is a hyper-local blog for a London neighbourhood, and its audience reflects that. It had an average of 120 unique visitors per day. Both sites are updated semi-frequently but irregularly.</p>
<h2>Selected stats</h2>
<p>The percentage split between mobile (including tablet) and non-mobile is 31.2 to 68.9. Of those mobile visitors, <abbr>iOS</abbr> accounted for 68.4 percent and Android for 23.3. Blackberry was a distant third, with other mobile <abbr>OS</abbr>es barely registering.</p>
<p><a href="/wp-content/uploads/2013/05/mobile-stats.png"><img src="/wp-content/uploads/2013/05/mobile-stats-300x110.png" alt="Pie charts showing Mobile/non-mobile visitors and popular mobile OS" width="300" height="110"></a></p>
<p>In overall <abbr>OS</abbr> stats, Windows is still by far the dominant platform, with more than double the visits of the second-placed <abbr>iOS</abbr>. Some strong variation to note here: Site A had 12.2 percent of visitors using <abbr>OS X</abbr>, with Site B on 27.1.</p>
<table>
<caption>Most popular <abbr>OS</abbr></caption>
<thead>
<tr>
<th>Operating system</th>
<th>% of total</th>
</tr>
</thead>
<tbody>
<tr>
<th>Windows</th>
<td>44.7</td>
</tr>
<tr>
<th><abbr>iOS</abbr></th>
<td>21.2</td>
</tr>
<tr>
<th><abbr>OS X</abbr></th>
<td>19.7</td>
</tr>
<tr>
<th>Android</th>
<td>7.3</td>
</tr>
</tbody>
</table>
<p>In overall browser stats, Safari is the perhaps surprising leader, thanks to the large share that <abbr>iOS</abbr> holds. Some very strong variance to note: Site A actually had Opera Mini in fourth place with 7 percent share, beating Android into sixth, while on Site B there were no hits at all from Opera Mini.</p>
<table>
<caption>Most popular browser</caption>
<thead>
<tr>
<th>Browser</th>
<th>% of total</th>
</tr>
</thead>
<tbody>
<tr>
<th>Safari</th>
<td>34.1</td>
</tr>
<tr>
<th>Chrome</th>
<td>21.6</td>
</tr>
<tr>
<th>IE</th>
<td>20.2</td>
</tr>
<tr>
<th>Firefox</th>
<td>12.3</td>
</tr>
<tr>
<th>Android (stock)</th>
<td>5</td>
</tr>
</tbody>
</table>
<p>Breaking Internet Explorer into the different versions, <abbr>IE9</abbr> is the most popular followed closely by <abbr>IE8</abbr>. Very gratifyingly, IE6 is barely existent and soon to be gone altogether. There was a point of strong variance here: Site A had <abbr>IE8</abbr> on 42.1 percent of the IE share and <abbr>IE9</abbr> on 41.6, while Site B had the same versions on 35.3 and 50.3 percent respectively.</p>
<table>
<caption>Internet Explorer versions</caption>
<thead>
<tr>
<th><abbr>IE</abbr> version</th>
<th>% of <abbr>IE</abbr> share</th>
<th>% of all browsers</th>
</tr>
</thead>
<tbody>
<tr>
<th><abbr>IE9</abbr></th>
<td>46</td>
<td>9.3</td>
</tr>
<tr>
<th><abbr>IE8</abbr></th>
<td>38.7</td>
<td>7.8</td>
</tr>
<tr>
<th><abbr>IE7</abbr></th>
<td>8.5</td>
<td>1.7</td>
</tr>
<tr>
<th><abbr>IE10</abbr></th>
<td>6</td>
<td>1.2</td>
</tr>
<tr>
<th><abbr>IE6</abbr></th>
<td>1</td>
<td>0.2</td>
</tr>
</tbody>
</table>
<p>Finally, in my original tweets I noted that over 98 percent of visitors running <abbr>iOS</abbr> devices used their phone in portrait mode, but this is incorrect; in fact <a href="http://www.quirksmode.org/mobile/tableViewport.html">Safari for <abbr>iOS</abbr> only shows dimensions for the portait mode, even when in landscape</a>, so there’s no way to get this figure. Android devices don’t follow the same pattern, however, so there we can see that an average of 92 percent of visits were made using a device in portrait mode. I can’t be sure where the false <abbr>iOS</abbr> figures came from; perhaps other browsers on <abbr>iOS</abbr>, or jailbroken devices.</p>
<h2>Speculation on variance</h2>
<p>There are a number of points of strong variation: in visitors using <abbr>OS X</abbr>; in the use of Opera Mini; and in <abbr>IE8</abbr> vs <abbr>IE9</abbr>. My broad theory to explain this is that Site A has a global audience, including a not insignificant number in emerging markets across Africa and Asia, whereas Site B is almost exclusively visited by (comparatively) wealthy Londoners, which explains the higher number of Macs in Site B, and the use of Opera Mini on Site A (from areas with poorer network coverage and a higher incidence of low-end handsets). As for IE, I’d speculate that you need a genuine copy of Windows 7 to run it, and I believe that Site A’s global popularity would mean that it’s used on pirated Windows which couldn’t install it.</p>
<p>Of course, this is all speculation, and with the limited sample base I have, especially on Site B, it could just be an aberration in the data. As always, it pays to use many different data sets.</p>
 <p><a href="http://www.broken-links.com/?flattrss_redirect&amp;id=2130&amp;md5=4bec362c553e305a610bde09f6e9a322" title="Flattr" target="_blank"><img src="http://www.broken-links.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.broken-links.com/2013/05/03/mobile-stats/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<atom:link rel="payment" title="Flattr this!" href="https://flattr.com/submit/auto?user_id=12916&amp;popout=1&amp;url=http%3A%2F%2Fwww.broken-links.com%2F2013%2F05%2F03%2Fmobile-stats%2F&amp;language=en_GB&amp;category=text&amp;title=Some+stats+on+OS+and+browser+share&amp;description=Last+week+on+Twitter+I+shared+some+browser+and+OS+statistics+from+a+site+I+manage.+These+turned+out+to+be+quite+popular%2C+so+I%E2%80%99ve+decided+to+expand+on+them...&amp;tags=analytics%2Cbrowser%2Cmobile%2Cos%2Cstats%2Cblog" type="text/html" />
	</item>
		<item>
		<title>40% off when you pre-order The Modern Web</title>
		<link>http://www.broken-links.com/2013/04/18/pre-order-the-modern-web-get-40-off/</link>
		<comments>http://www.broken-links.com/2013/04/18/pre-order-the-modern-web-get-40-off/#comments</comments>
		<pubDate>Thu, 18 Apr 2013 22:35:37 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Asides]]></category>
		<category><![CDATA[Books]]></category>
		<category><![CDATA[book]]></category>
		<category><![CDATA[modern web]]></category>
		<category><![CDATA[the modern web]]></category>

		<guid isPermaLink="false">http://www.broken-links.com/?p=2124</guid>
		<description><![CDATA[I’m very excited to be holding a copy of my new book, The Modern Web, in my hands, and nervous to see what everyone else thinks when it goes on sale next week. If you’d like a copy you can get a whopping 40% off when you pre-order through the publisher in the next week [...]]]></description>
				<content:encoded><![CDATA[<p>I’m very excited to be holding a copy of my new book, <em><a href="http://nostarch.com/modernweb">The Modern Web</a></em>, in my hands, and nervous to see what everyone else thinks when it goes on sale next week. If you’d like a copy you can <a href="http://nostar.ch/modernweb_promo">get a whopping 40% off when you pre-order through the publisher</a> in the next week — plus every print copy comes with a FREE eBook. I hope you’ll consider pre-ordering, and look forward (guardedly!) to hearing what you think.</p>
 <p><a href="http://www.broken-links.com/?flattrss_redirect&amp;id=2124&amp;md5=19336e70e93e14b8f76f75240bee7340" title="Flattr" target="_blank"><img src="http://www.broken-links.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.broken-links.com/2013/04/18/pre-order-the-modern-web-get-40-off/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" title="Flattr this!" href="https://flattr.com/submit/auto?user_id=12916&amp;popout=1&amp;url=http%3A%2F%2Fwww.broken-links.com%2F2013%2F04%2F18%2Fpre-order-the-modern-web-get-40-off%2F&amp;language=en_GB&amp;category=text&amp;title=40%25+off+when+you+pre-order+The+Modern+Web&amp;description=I%E2%80%99m+very+excited+to+be+holding+a+copy+of+my+new+book%2C+The+Modern+Web%2C+in+my+hands%2C+and+nervous+to+see+what+everyone+else+thinks+when+it+goes+on...&amp;tags=book%2Cmodern+web%2Cthe+modern+web%2Cblog" type="text/html" />
	</item>
		<item>
		<title>Introducing HTML’s new template element</title>
		<link>http://www.broken-links.com/2013/04/10/the-template-element/</link>
		<comments>http://www.broken-links.com/2013/04/10/the-template-element/#comments</comments>
		<pubDate>Wed, 10 Apr 2013 10:15:09 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[html]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[template]]></category>
		<category><![CDATA[web components]]></category>

		<guid isPermaLink="false">http://www.broken-links.com/?p=2102</guid>
		<description><![CDATA[You may have heard of Web Components, a suite of emerging standards that make it possible to build secure reusable widgets using web platform technologies. One of the first specs to make its way into implementation is HTML Templates, embodied by the template element, which as I write this is implemented in Chrome Canary and [...]]]></description>
				<content:encoded><![CDATA[<p>You may have heard of <em>Web Components</em>, a suite of emerging standards that make it possible to build secure reusable widgets using web platform technologies. One of the first specs to make its way into implementation is <a href="https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/templates/index.html">HTML Templates</a>, embodied by the <code>template</code> element, which as I write this is implemented in Chrome Canary and Firefox Nightly.</p>
<p><span id="more-2102"></span></p>
<p>If you’ve used <a href="https://github.com/janl/mustache.js/">Mustache</a>, <a href="http://handlebarsjs.com/">Handlebars</a> or any similar front-end templating library you’ll be quite familiar with how the <code>template</code> element works: you just include it in your document (it’s apparently legal inside <code>head</code> or <code>body</code>), perhaps with a unique <code>id</code> for easy reference, and add some markup inside it; for example:</p>
<pre>&lt;template id="foo"&gt;
  &lt;h2&gt;Hello, world!&lt;/h2&gt;
  &lt;hr&gt;
&lt;/template&gt;</pre>
<p>The <code>template</code> element will be parsed by the browser but not rendered in the page; the markup inside is considered completely inert, meaning no style rules will be applied, and no assets loaded. In order to use the template markup you’ll need to activate it by placing it into the <abbr>DOM</abbr> using JavaScript. As an illustration let’s presume I have the above markup in my document, along with some content which will be rendered:</p>
<pre>&lt;div id="bar"&gt;
  &lt;h1&gt;The template element&lt;/h1&gt;
&lt;/div&gt;</pre>
<p>What I want to do is make a copy of the markup inside the <code>template</code> element by using the <code>cloneNode()</code> method on the <code>content</code> property, then insert it into the <abbr>DOM</abbr>; I’ll do this using the <code>appendChild()</code> method. To achieve this, my script looks like so:</p>
<pre>var foo = document.getElementById('foo'),
    bar = document.getElementById('bar'),
    cloned = foo.content.cloneNode(true);
bar.appendChild(cloned);</pre>
<p>Now the <code>h2</code> and <code>hr</code> elements will be appended to <code>div#bar</code>, after the <code>h1</code> element; note that the markup becomes active at this point, so any relevant assets will be loaded. The resulting markup will appear like so:</p>
<pre>&lt;div id="bar"&gt;
  &lt;h1&gt;The template element&lt;/h1&gt;
  &lt;h2&gt;Hello, world!&lt;/h2&gt;
  &lt;hr&gt;
&lt;/div&gt;</pre>
<p>You can see the result for yourself in this example file:</p>
<p><a href="/tests/webcomponents/template.php">Demo: the <code>template</code> element</a></p>
<p>As mentioned, this is already implemented in Chrome Canary (you’ll need to enable the <em>experimental WebKit features</em> flag in <strong>chrome://flags/</strong>) and Firefox Nightly, although there’s no news yet on when this will be in a release version.</p>
<p>This is a really simple example, but hopefully you can see how rich with potential this is; you can dynamically update the code each time you clone it, making it totally reusable. The <code>template</code> element is just a small part of Web Components, which I’ll be aiming to cover in more detail over the coming months.</p>
<p>NB: After writing this post I found the article <a href="http://www.html5rocks.com/en/tutorials/webcomponents/template/">HTML’s New Template Tag</a> on <em>HTML5 Rocks!</em>, which covers the subject in a little more depth. It’s written by <a href="http://ericbidelman.tumblr.com/">Eric Bidelman</a>, who’s pretty much the authority on Web Components.</p>
<p><strong>Update:</strong> I should point out that when the spec is fully implemented, templates will be shareable across multiple pages by linking to them in the document head:</p>
<pre>&lt;link rel="import" href="templates.html"&gt;</pre>
 <p><a href="http://www.broken-links.com/?flattrss_redirect&amp;id=2102&amp;md5=39b9c5468f810c0fee91603dab177d49" title="Flattr" target="_blank"><img src="http://www.broken-links.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.broken-links.com/2013/04/10/the-template-element/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		<atom:link rel="payment" title="Flattr this!" href="https://flattr.com/submit/auto?user_id=12916&amp;popout=1&amp;url=http%3A%2F%2Fwww.broken-links.com%2F2013%2F04%2F10%2Fthe-template-element%2F&amp;language=en_GB&amp;category=text&amp;title=Introducing+HTML%E2%80%99s+new+template+element&amp;description=You+may+have+heard+of+Web+Components%2C+a+suite+of+emerging+standards+that+make+it+possible+to+build+secure+reusable+widgets+using+web+platform+technologies.+One+of+the+first+specs...&amp;tags=html%2Chtml5%2Ctemplate%2Cweb+components%2Cblog" type="text/html" />
	</item>
		<item>
		<title>The Modern Web: download a sample chapter</title>
		<link>http://www.broken-links.com/2013/04/08/the-modern-web-download-a-sample-chapter/</link>
		<comments>http://www.broken-links.com/2013/04/08/the-modern-web-download-a-sample-chapter/#comments</comments>
		<pubDate>Mon, 08 Apr 2013 20:05:40 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Books]]></category>
		<category><![CDATA[book]]></category>
		<category><![CDATA[modern web]]></category>
		<category><![CDATA[self promotion]]></category>
		<category><![CDATA[the modern web]]></category>

		<guid isPermaLink="false">http://www.broken-links.com/?p=2098</guid>
		<description><![CDATA[My new book, The Modern Web, will be released at the end of this month, and if you’re interested in reading a sample you can download a PDF of Chapter 6: Device APIs. Readers in North America can now pre-order a copy from the Barnes &#38; Noble website, or drop in to a B&#38;N store [...]]]></description>
				<content:encoded><![CDATA[<p>My new book, <a href="http://nostarch.com/modernweb">The Modern Web</a>, will be released at the end of this month, and if you’re interested in reading a sample you can <a href="http://nostarch.com/download/samples/modernweb_ch6.pdf">download a <abbr>PDF</abbr> of Chapter 6: Device <abbr>API</abbr>s</a>. Readers in North America can now <a href="http://www.barnesandnoble.com/w/the-modern-web-peter-gasston/1114672512">pre-order a copy from the Barnes &amp; Noble website</a>, or drop in to a <abbr>B&amp;N</abbr> store in a few weeks.</p>
 <p><a href="http://www.broken-links.com/?flattrss_redirect&amp;id=2098&amp;md5=e307fda2ff65b7edcbd76e711176d179" title="Flattr" target="_blank"><img src="http://www.broken-links.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.broken-links.com/2013/04/08/the-modern-web-download-a-sample-chapter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" title="Flattr this!" href="https://flattr.com/submit/auto?user_id=12916&amp;popout=1&amp;url=http%3A%2F%2Fwww.broken-links.com%2F2013%2F04%2F08%2Fthe-modern-web-download-a-sample-chapter%2F&amp;language=en_GB&amp;category=text&amp;title=The+Modern+Web%3A+download+a+sample+chapter&amp;description=My+new+book%2C+The+Modern+Web%2C+will+be+released+at+the+end+of+this+month%2C+and+if+you%E2%80%99re+interested+in+reading+a+sample+you+can+download+a+PDF+of+Chapter...&amp;tags=book%2Cmodern+web%2Cself+promotion%2Cthe+modern+web%2Cblog" type="text/html" />
	</item>
		<item>
		<title>Creating a custom icon font using IcoMoon</title>
		<link>http://www.broken-links.com/2013/04/04/creating-custom-icon-font-using-icomoon/</link>
		<comments>http://www.broken-links.com/2013/04/04/creating-custom-icon-font-using-icomoon/#comments</comments>
		<pubDate>Thu, 04 Apr 2013 10:00:28 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[font]]></category>
		<category><![CDATA[icomoon]]></category>
		<category><![CDATA[icon font]]></category>
		<category><![CDATA[inkscape]]></category>
		<category><![CDATA[svg]]></category>
		<category><![CDATA[web font]]></category>

		<guid isPermaLink="false">http://www.broken-links.com/?p=2032</guid>
		<description><![CDATA[As you probably know, icon (or, symbol) fonts are a great way to implement scalable, styleable icons which work across pretty much every browser (every one that supports web fonts, anyway). There are many top quality icon fonts available, such as Pictos and Font Awesome, but sometimes you’ll want to create your own bespoke icons. [...]]]></description>
				<content:encoded><![CDATA[<p>As you probably know, <a href="http://alistapart.com/article/the-era-of-symbol-fonts">icon (or, symbol) fonts</a> are a great way to implement scalable, styleable icons which work across pretty much every browser (every one that supports web fonts, anyway). There are many top quality icon fonts available, such as <a href="http://pictos.cc/">Pictos</a> and <a href="http://fortawesome.github.com/Font-Awesome/">Font Awesome</a>, but sometimes you’ll want to create your own bespoke icons. Github wrote detailed instructions of how they made their icon set, Octicons, in their post <a href="https://github.com/blog/1135-the-making-of-octicons">The Making of Octicons</a>, but that relies on using some professional tools. In this article I’m going to show simple alternative method that uses the brilliant free tool, <a href="http://icomoon.io/">IcoMoon</a>.<span id="more-2032"></span></p>
<h2>Creating your icon</h2>
<p>To get started you need one other piece of software, which is a graphics package capable of exporting SVG. You can use Adobe Illustrator if you have it, or consider the fantastic <a href="http://code.google.com/p/svg-edit/">SVG Edit</a> if not. I prefer <a href="http://inkscape.org/">Inkscape</a>, which is fully featured and free (although the interface has a slight learning curve).</p>
<p>IcoMoon icons are based on 16x16 pixel grid by default, so in your vector graphics software make a new document on a square grid which is a multiple of 16 on each side; I find that 512 is ample for most icons, although you could use, for example, 256, 1024 or 2048. The larger your grid, the more detailed your icon can be — but do bear in mind that detail doesn’t always scale down well.</p>
<p>The next step is to draw your icon. You’ll want to overlay a grid on the canvas to help with the positioning of the components of your icon. If you can, change the units of your grid to multiples of 16; if that’s not possible, size and position objects by dividing the dimensions of the canvas by 16. For example, when I’m working on a canvas that’s 512 squared I use multiples of 32 (512 ÷ 16); so if I want an object that will be 4×4 in size and 2 from the top in my finished pixel grid, I make it 128×128 and 64 from the top in Inkscape.</p>
<p>It’s also very important to make sure that objects snap to the grid you’ve created; if they don’t then the browser’s rendering engine will use aliasing to try to compensate when scaling, which can result in fuzzy edges on your icon — the opposite of what you’re aiming for. The following image shows my icon aligned to the grid (left) and off it (right).</p>
<p><a href="/wp-content/uploads/2013/04/inkscape-grids.png"><img alt="Comparing icon snapping to a grid" src="/wp-content/uploads/2013/04/inkscape-grids-300x148.png" width="300" height="148" /></a></p>
<p>Using a scaled grid and snapping objects to it will help a lot in making the icon perfectly scalable.</p>
<p>IcoMoon has some good <a href="http://icomoon.io/#docs/importing">tips on making icons that import well</a>, and one that has tripped me up many times is that you should not use strokes, as they’re not rendered; use shapes only, or at least convert your strokes to shapes.</p>
<h2>Adding your icon to a font</h2>
<p>When your icon is complete, export the file as an <abbr>SVG</abbr>, then fire up IcoMoon. The first step of using this is to import your <abbr>SVG</abbr> file(s); if they’ve been built correctly they’ll be shown in the <em>Your Custom Icons</em> section. Highlight the ones you want to use in your font, and proceed to the next step by tapping the <strong>Font</strong> button.</p>
<p>On the following page all of your new icons are shown, and you can rearrange them and assign them to different characters in the <abbr title="Unicode Transformation Format">UTF</abbr> table. When you’re satisfied with your organisation, tap <strong>Download</strong> and you’ll be presented with an archive file, inside which is a folder containing your font in <abbr>WOFF</abbr>, <abbr>TTF</abbr>, <abbr>EOT</abbr> and <abbr>SVG</abbr> formats. You can then add these to your document using <code>@font-face</code>.</p>
<p>Below is the icon I made earlier, shown at three different sizes so you can see for yourself how nicely it scales.</p>
<ul class="post-2032">
<li>a</li>
<li class="med">a</li>
<li class="lrg">a</li>
</ul>
<p>That’s about it. You may need to tweak and finesse a few times initially until you get the desired result, but that’s really all there is to creating your own icon fonts.</p>
 <p><a href="http://www.broken-links.com/?flattrss_redirect&amp;id=2032&amp;md5=4d2d2251b51ed37bc0c0aa5afeef6cfe" title="Flattr" target="_blank"><img src="http://www.broken-links.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.broken-links.com/2013/04/04/creating-custom-icon-font-using-icomoon/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" title="Flattr this!" href="https://flattr.com/submit/auto?user_id=12916&amp;popout=1&amp;url=http%3A%2F%2Fwww.broken-links.com%2F2013%2F04%2F04%2Fcreating-custom-icon-font-using-icomoon%2F&amp;language=en_GB&amp;category=text&amp;title=Creating+a+custom+icon+font+using+IcoMoon&amp;description=As+you+probably+know%2C+icon+%28or%2C+symbol%29+fonts+are+a+great+way+to+implement+scalable%2C+styleable+icons+which+work+across+pretty+much+every+browser+%28every+one+that+supports+web+fonts%2C...&amp;tags=font%2Cicomoon%2Cicon+font%2Cinkscape%2Csvg%2Cweb+font%2Cblog" type="text/html" />
	</item>
		<item>
		<title>Removing the whitespace from inline block elements</title>
		<link>http://www.broken-links.com/2013/03/25/removing-the-whitespace-from-inline-block-elements/</link>
		<comments>http://www.broken-links.com/2013/03/25/removing-the-whitespace-from-inline-block-elements/#comments</comments>
		<pubDate>Mon, 25 Mar 2013 14:00:47 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[technique]]></category>

		<guid isPermaLink="false">http://www.broken-links.com/?p=1924</guid>
		<description><![CDATA[There are two common methods of building a horizontal component, such as navigation: using floats; or setting the display property to inline-block. This latter approach makes child elements run in to the same horizontal line in the document flow but preserves their block behaviour, and is pretty effective because you don’t have to worry about [...]]]></description>
				<content:encoded><![CDATA[<p>There are two common methods of building a horizontal component, such as navigation: using floats; or setting the <code>display</code> property to <code>inline-block</code>. This latter approach makes child elements run in to the same horizontal line in the document flow but preserves their block behaviour, and is pretty effective because you don’t have to worry about clearing floats as you would in the alternative technique. It does, however, have a drawback.</p>
<p><span id="more-1924"></span></p>
<p>Before I explain that drawback, let me set the scene with some very simple example markup of a list used for navigation:</p>
<pre>&lt;ul&gt;
&lt;li&gt;Nav One&lt;/li&gt;
&lt;li&gt;Nav Two&lt;/li&gt;
&lt;li&gt;Nav Three&lt;/li&gt;
&lt;li&gt;Nav Four&lt;/li&gt;
&lt;/ul&gt;</pre>
<p>And some CSS to make it display horizontally:</p>
<pre>li {
  display: inline-block;
  width: 25%;
}</pre>
<p>As you can see in the following example, when this renders there’s a small amount of whitespace between each child item; this can cause a problem if you want to use percentage widths to fill the parent, as the whitespace forces the final element onto a new line.</p>
<ul class="example-1924">
<li>Nav One</li>
<li>Nav Two</li>
<li>Nav Three</li>
<li>Nav Four</li>
</ul>
<p>This is caused by the markup being broken over multiple lines; when items are displayed as <code>inline-block</code> any carriage returns or tabs in the markup are recognised as a whitespace character. That being the case, you can fix this problem by writing your markup with no space between the items:</p>
<pre>&lt;ul&gt;&lt;li&gt;Nav One&lt;/li&gt;&lt;li&gt;Nav Two&lt;/li&gt;&lt;li&gt;Nav Three&lt;/li&gt;&lt;li&gt;Nav Four&lt;/li&gt;&lt;/ul&gt;</pre>
<p>If you prefer a CSS approach the usual fix for this is to set a negative <code>margin-right</code> value on each child element, but I recently happened upon another approach: as each element is rendered as if it were a word in a sentence, it’s also possible to use a negative value on the <code>word-spacing</code> property of the parent:</p>
<pre>ul { word-spacing: -0.26em; }</pre>
<p>The value seems to be about 25% of the font size, except in Firefox where it seems to be 26%. Note that this is only relevant for <code>font-size</code> values of 16px or over; below that, the percentage should be increased. Anyway, the result is that the whitespace is removed:</p>
<ul class="example-1924" id="example-1924-1">
<li>Nav One</li>
<li>Nav Two</li>
<li>Nav Three</li>
<li>Nav Four</li>
</ul>
<p>There is a drawback to this, in that the value of <code>word-spacing</code> is inherited by all of the child elements, so if they contain multiple-word values you’ll have to restore <code>word-spacing</code> to its default value:</p>
<pre>li { word-spacing: 0; }</pre>
<ul class="example-1924" id="example-1924-2">
<li>Nav One</li>
<li>Nav Two</li>
<li>Nav Three</li>
<li>Nav Four</li>
</ul>
<p>The <code>initial</code> keyword would be even better here, but its use is somewhat limited as it’s not yet supported by Internet Explorer.</p>
<p>As this method potentially relies on using two properties, I’m not sure it’s any better than using a negative value on <code>margin-right</code>; really I just wanted to record this for future use, as I haven’t seen it documented elsewhere.</p>
<p><strong>Update:</strong> I have to hold my hands up and admit that I didn’t properly test the first version of this article. The value of <code>word-spacing</code> is relative to <code>font-size</code>, so the value I originally used in my examples, 4px, is only relevant at the default font-size of 16px. The updated value I’ve used instead, 0.26em, works better in all of the browsers I’ve tested but you may need to double-check this yourself — there is certainly some unexpected behaviour in Safari.</p>
<p>The best approach might be an alternative suggested in the comments; set a <code>font-size</code> of 0 on the parent to remove the whitespace problem, then set the desired font size on the children; e.g.:</p>
<pre>ul { font-size: 0; }
li { font-size: 1.6rem; }</pre>
 <p><a href="http://www.broken-links.com/?flattrss_redirect&amp;id=1924&amp;md5=72a269e163dffe06d07a51acf52eecfe" title="Flattr" target="_blank"><img src="http://www.broken-links.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.broken-links.com/2013/03/25/removing-the-whitespace-from-inline-block-elements/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		<atom:link rel="payment" title="Flattr this!" href="https://flattr.com/submit/auto?user_id=12916&amp;popout=1&amp;url=http%3A%2F%2Fwww.broken-links.com%2F2013%2F03%2F25%2Fremoving-the-whitespace-from-inline-block-elements%2F&amp;language=en_GB&amp;category=text&amp;title=Removing+the+whitespace+from+inline+block+elements&amp;description=There+are+two+common+methods+of+building+a+horizontal+component%2C+such+as+navigation%3A+using+floats%3B+or+setting+the+display+property+to+inline-block.+This+latter+approach+makes+child+elements+run+in...&amp;tags=css%2Ctechnique%2Cblog" type="text/html" />
	</item>
	</channel>
</rss>

<!-- Dynamic page generated in 0.836 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2013-06-20 00:48:38 -->
