Helping ordinary people create extraordinary websites!
HOME TUTORIALS SCRIPTS WEB HOSTING BLOG FORUM
Get Our Newsletter
Email:

A Designer's Guide to Prototyping Ajax

By Kevin Hale
2007-11-23


CSS Skills

Being a designer’s guide, I recognize that this is probably your forte. I’ll try to keep this brief—linking to better sources where appropriate. But yes, you’ll definitely need those CSS skills. In addition to your normal layout shenanigans, here’s what you’ll want to catch up on:

The Display Property

First, you’ll want to know exactly how the display property differs from the visibility property. If you think the display property is only good for making elements appear and disappear, you’re barely scratching the surface. The display property controls how a browser renders the fundamental structure (the box) of every element on a page. It is is an all-powerful property. In addition to making things disappear, the display property can fix a majority of IE rendering problems and even make divs and spans behave exactly like a list element or even a table cell. Specifically, you’ll want to know with confidence the difference between block, inline, inline-block and list-item. PPK always tells this story best.

Controlling Box Generation

While you’re looking up the display property, review the visual formatting model and specifically the section on how to control box generation. The visual formatting model dictates that each element in the document tree generates zero or more boxes according to the box model. You’ll want to know which elements by default are inline and which elements by default are block. You’ll also want to take a look into Internet Explorer’s peculiar responses to “hasLayout.”. Make sure you’re familiar with what elements have “layout” by default and the style properties needed to invoke “layout.”

CSS Specificity

I’ve seen too many stylesheets covered with unnecessary !important rules that prevented many a developer from changing an element on the fly. These were usually the result of an incomplete understanding of CSS specificity. Specificity is used in a browser’s secondary sort to help determine cascading order. Translated: If you have two (or more) conflicting CSS rules pointing to the same element, there are some basic rules that a browser follows to determine which one is the most specific and therefore applied to the markup.

A selector’s specificity is calculated as follows:

  • Count the # of ID attributes in the selector (= a)
  • Count the # of other attributes and pseudo-classes in the selector (= b)
  • Count the # of element names in the selector (= c)
  • Ignore pseudo-elements.

For Example:

*              {}  /* a=0 b=0 c=0 -> specificity =   0 */
li {} /* a=0 b=0 c=1 -> specificity = 1 */
ul li {} /* a=0 b=0 c=2 -> specificity = 2 */
ul li a {} /* a=0 b=0 c=3 -> specificity = 3 */
a:hover {} /* a=0 b=1 c=1 -> specificity = 11 */
ul li a.red {} /* a=0 b=1 c=3 -> specificity = 13 */
li a.red:hover {} /* a=0 b=2 c=2 -> specificity = 22 */
#candy {} /* a=1 b=0 c=0 -> specificity = 100 */

For more information, check out what Eric and Molly have to say about specificity.

Image Replacement

You will use this probably infinity times. Good thing there’s like a million ways to do it. Know this cold. For Ajax applications, I recommend avoiding a JavaScript method for this. Personally, I love text-indent:-9000px.

More Information

Alright, that does it for our introduction and cursory XHTML and CSS review. Next Monday, come back for DGPA Part 2 : Ajax Wireframing, where we’ll go over several techniques we’ve developed to prepare our markup and CSS for the protoyping process. Until then, please read up on what other developers have to say about the benefits of wireframing and prototyping and let us know some of your thoughts on the topic as well.



Tutorial Pages:
» Introduction
» There are No Heroes in Prototyping
» Relationship Skills
» XHTML Skills
» CSS Skills


 | Bookmark
Related Tutorials:
» Getting Started with AJAX in jQuery
» GWT Basics: AJAX Programming with Java
» AJAX Accessibility for Websites
» AJAX and PHP Form Processing
» The obligatory 'My Ajax Tutorial' Post
» Ajax Wireframing Approaches