2010 will be the year of consolidation of internet usage via mobile devices. According to internetnews.com, which reports a Gartner analysis, mobile device sales will rise (9%) in 2010. This scenario will impose to internet companies, online newspapers, bloggers, to provide mobile versions of their websites to simplify the fruition of their contents and enlarge their audience. In this post I prepared a roundup of code snippets inspired to some mobile versions of popular websites (such as Facebook, Flickr, The New York Times, Digg, Google, …) that illustrate some HTML best practices to develop perfect websites for iPhone and mobile Devices.
Facebook Touch for iPhone

Let’s start with Facebook Touch for iPhone (touch.facebook.com). The iPhone version of Facebook is characterized by single-column structure (with fluid width) that contains three main sections: header, main content and footer.
The header section contains the top bar, which includes the notification icon, Facebook logo and search, and the menu bar that contains four links (home, profile, friends and inbox).
The main content section contains information about the current page (home, profile, wall, info…).
The footer section contains links to select language, switch to full site, logout, and copyright information. This kind of HTML structure (single-column, fluid width, three main sections: header, main content and footer) is widespread in mobile web design because it allows to organize content in a way that fits perfectly most mobile screen sizes. Here is the sample HTML code you can use to implement this layout:
<div id="header">
<div id="topbar">...</div>
<div id="menubar">
<ul>
<li><a href="home.html">Home</a></li>
<li><a href="profile.html">Profile</a></li>
<li><a href="friends.html">Friends</a></li>
<li><a href="inbox.html">Inbox</a></li>
<ul>
</div>
</div>
<div id="content">
<div id="page_menu">...</div>
<div id="page">...</div>
</div>
<div id="footer">...</div>
<div id="header"> contains <div id="topbar"> (notification icon, Facebook logo and search) and <div id="menubar"> (home, profile, friends and inbox).
<div id="content"> contains <div id="page_menu" (wall, info, photos) and <div id="page"> (current page loaded, in this case the Wall of my Facebook profile).
Flickr Mobile

Flickr mobile (m.flickr.com) also implements a single-column layout that presents the same characteristics of Facebook Touch layout (one column, fluid width, three main sections: header, main content, footer).
The header section contains Flickr logo, sing-in information and the navigation bar.
The main content section contains information about the current page (in this case the Flickr home page).
The footer section contains some information about Flickr and links to switch to original site, download the iPhone app, report abuse and sign-out.
Here are some suggestions to implement a perfect navigation bar for mobile devices. I suggest you to use tab-based navigation, tabbed links with relative width and the display CSS property set to block.
Here is the typical HTML code to implement a standard navigation bar:
<div id="nav">
<ul>
<li><a href="/activity">Activity</a></li>
<li><a href="/you">You</a></li>
<li><a href="/contacts">Contacts</a></li>
<li><a href="/more">More</a></li>
<ul>
</div>
And here is a sample CSS code:
#nav ul li {
float:left;
width:25%;
text-align:center;
...
}
#nav ul li a {display:block;}
The New York Times Mobile

Now let’s take a look at the mobile version of The New York Times newspaper (mobile.nytimes.com).
The HTML structure is a little bit more complex than the previous websites but it maintains the same characteristics and sections of Facebook and Flickr layouts (one column with, fluid width, three main sections: header, main content, footer).
The header sections contains The New York Times logo, date, weather, financial information and the search field.
The main content section contains latest news. Below the main content section there are other sections organized by topic (Technology, U.S. News,…) with a list of links.
The footer section contains links to download the iPhone app, send feedback, copyright information and an user login form.
Just a note for sections below the main content section. You can use the <h3> tag for section titles and the <ul> tag for the list of links.
<h3>Technology</h3>
<ul>
><li><a href="link_1.html">Title 1</a></li>
><li><a href="link_2.html">Title 2</a></li>
><li><a href="link_3.html">Title 3</a></li>
<ul>
Time

The layout of the mobile version of Time (mobile.time.com) is similar to The New York Times.
The header section contains Time logo and a button with a link to switch to standard site.
The main content section contains a list of Top Stories. Below this section there are other sections organized by topic (U.S., Quotes of the Day, Photo Essays,…). You can use the <h3> tag for section titles and the <ul> tag for the list of links.
The footer section contains links to Help, About Time, Subscribe to Time, CNN International, and copyright informations.
Digg

The mobile version of Digg (m.digg.com) is clean and minimalist.
The header section contains a top menu (digg logo, Topics, Login) and a navigation bar.
The main content section contains the most recent stories (digg counter and title) and pagination buttons.
The footer sections is really simple and just contains the link to the regular version of Digg.
Here is the sample HTML code you can use to implement a Digg-like layout for mobile devices:
<div id="header">
<div id="h_menu">...</div>
<div id="nav">...</div>
</div>
<div id="stories">
<div class="story">...</div>
</div>
<div id="pagination">...</div>
<div id="footer">...</div>
Just for curiosity, the mobile version of Digg uses tables for the website layout! Here is the code used for the top menu:
<table>
<tr>
<td class="h-logo"><a href="/"><img src="/img/logo.gif"/></a></td>
<td class="h-menu">
<a class="settings" href="/topics">Topics</a>
<a class="button" href="/login">Login</a>
</td>
</tr>
</table>
As you see, it uses the <table> tag to separate links in the top menu. Using tables for design the structure of HTML pages is not a good practice but, I have to admit, in some cases is simpler and quicker than creating floating elements.
Mixx

The HTML structure of Mixx (i.mixx.com) is similar to Digg but it’s simpler.
The header section contains Mixx logo and the navigation bar.
The main content section contains a list of stories. No footer is present.
Google Mobile

The mobile version of Google is a great balance between simplicity and perfect usability.
The header section contains the navigation bar and Google logo.
The main content section contains the search field and short messages with the latest news about Google services.
The footer section contains links to iGoogle, Settings and Help.
It’s interesting to take a look at the multi-level navigation bar present in the Google home page. When you click on the link “more” it appears a list that contains links to other Google services. The following image illustrates an example of typical HTML structure you can use to implement a multi-level navigation bar like that:
Here is a sample HTML code you can use to implement a multi-level navigation bar simply using nasted <ul> tags:
<div id="header">
<div id="nav">
<ul>
<li><a href="/web">Web</li>
<li><a href="/image">Images</li>
<li><a href="/News">News</li>
<li>More
<ul>
<li><a href="/Maps">Maps</li>
<li><a href="/Readers">Readers</li>
<li><a href="/Translator">Translator</li>
</ul>
</li>
</ul>
</div>
</div>
Bing Mobile

The mobile version of Bing (m.bing.com) tries to replicate the simplicity of Google mobile, but the alignment difference between some elements make the page less neat than the Google home page (the bing logo is aligned to left, navigation bar and search field are centered, location settings and “Bing for iPhone” message are aligned to left, footer links are centered).
Mashable Mobile
I want to conclude this roundup of websites with the mobile version of Mashable (mashable.com) that can be useful to take inspiration for the mobile version of your blog.
The header section contains Mashable Logo, search field and the navigation bar with links to main channels.
The main content section contains a list of most recent posts.
The footer section contains copyright information and a link to switch to standard site.
Frameworks for iPhone Developers
Here is a small list of my favorite Frameworks to develop websites for iPhone:
IUI is a User Interface Framework for Safari development on iPhone that allows you to make WebApps that look and feel like iPhone native application.
jQTouch is a jQuery plugin for mobile web development on the iPhone, iPod Touch, and other forward-thinking devices.
jQuery iPhone UI is a JavaScript library for prototype iPhone interface on web pages.