Use CSS display:table for Layout

For a few years now, web developers doing CSS-based layouts have used floats or absolute positioning for layout web sites to avoid using non-semantic HTML <table>s.

While doable, extra hoops often have to be jumped through (mostly for IE) and some seemingly simple things can be harder than necessary (like equal height columns).

However, for a simpler solution, CSS-based display:table, display:table-row, display:table-cell etc are all usable today across Firefox 2+, Safari 3+, Opera 9+ and IE8. Continue reading

Google App Engine as your own Content Delivery Network

24 Ways has an excellent article on using Google App Engine as your own Content Delivery Network.

A CDN is a network of servers around the world to serve content from your site from the nearest physical location. All the large sites (Yahoo, Google, Amazon, etc) use them.

After reading the above post, I was also curious to find out how if Google App Engine helps in the following: compression, expires headers and versioning. It looks like it does. Continue reading

Jonathan Snook’s jQuery Background Animation as a Plugin

Jonathan Snook recently posted a really neat background animation technique using jQuery. This was something I was looking for and it seemed like a good candidate for a jQuery plugin.

So, following on from my recent post about turning jQuery code into richer, unit testable plugin code, I thought I’d describe the quick process of doing so here. (It’s worth reading Snook’s post first though!) Continue reading

Turn your jQuery code into a richer, unit testable, plugin

I find myself increasingly using jQuery as my JavaScript framework of choice.

It’s by-line of “write less, do more” really seems apt.

But sometimes, by writing just that little bit extra, you can do even more.

For example, I often try to do the following:

  • Make most jQuery code into reusable plugins
  • Use the jQuery plugin development pattern for added flexibility
  • Use QUnit to unit test JavaScript
  • Combine the two approaches to drive out a richer API for the plugin

By unit testing with QUnit, I find I often need to trigger additional events or add additional code from within the plugin so the test can be meaningful.

But this extra code isn’t only useful for testing, it becomes a useful part of the plugin’s API, improving its functionality and flexibility without sacrificing maintainability and readability of the code.

I’ll try to demonstrate that in this post. Continue reading

Google to host a number of JavaScript libraries

Google just announced their AJAX Library API, where Google will host many major JavaScript frameworks for you, such as jQuery, Prototype, Mootools, Dojo, etc.

This will allow you to write web pages that refer to those scripts rather than copies on your own site, reducing your bandwidth, but also leveraging the infrastructure capabilities of Google, such as their content distributed network (which means users would be served those files from a location much closer to them), properly compressed, minified, cacheable files, etc. Continue reading

How to fix huge text in Firefox 3 Beta 5 on Kubuntu 8.04

Firefox 3.0 beta 5 on Kubuntu 8.04 renders some text way too big. It turns out to be an issue when using points for your font size units in CSS (although generally relative units should be preferred, anyway!). You can fix this by

  1. Going to about:config
  2. Look for the setting called layout.css.dpi. The default value is -1.
  3. Change it to 96

The problem appears not to be Firefox, but the GNOME window manager’s settings. However, I don’t know how to change those when running KDE instead of GNOME. Anyone know?

Firebug may also have trouble running so this post has a tip on how to sort that out. Continue reading

Searching for apps and commands by typing rather than clicking; is typing the new clicking?

Microsoft recently announced an add-on to Office 2007 to let people search for commands by typing it in if they can’t find it in the new Ribbon user interface.

I find it interesting that a number of interfaces are now offering “shortcuts” to mouse clicking everywhere.

Is typing become the new clicking? Continue reading